Handle video pages correctly.
authorhpa <hpa>
Thu, 29 Jan 2004 06:54:51 +0000 (06:54 +0000)
committerhpa <hpa>
Thu, 29 Jan 2004 06:54:51 +0000 (06:54 +0000)
NEWS
bios.inc
conio.inc
font.inc
isolinux.asm
ldlinux.asm
pxelinux.asm

diff --git a/NEWS b/NEWS
index c5a46e2..2604bac 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,10 @@ apply to that specific program only; other changes apply to all of
 them.
 
 Changes in 2.09:
-       * SYSLINUX: Remove residual setuid crap from syslinux-nomtools.
+       * SYSLINUX: Remove residual setuid crap from
+         syslinux-nomtools.
+       * Handle video pages correctly when using the API functions.
+       * Handle compiling on an x86-64 platform correctly.
 
 Changes in 2.08:
        * Add new configuration command "ontimeout" to allow timeout
index d85df55..9002a3e 100644 (file)
--- a/bios.inc
+++ b/bios.inc
@@ -1,7 +1,7 @@
 ;; $Id$
 ;; -----------------------------------------------------------------------
 ;;   
-;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2004 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
@@ -28,6 +28,8 @@ fdctab2               resw 1
 serial_base    resw 4                  ; Base addresses for 4 serial ports
                absolute 0413h
 BIOS_fbm       resw 1                  ; Free Base Memory (kilobytes)
+               absolute 0462h
+BIOS_page      resb 1                  ; Current video page
                absolute 046Ch
 BIOS_timer     resw 1                  ; Timer ticks
                absolute 0472h
index 535028b..a0a2063 100644 (file)
--- a/conio.inc
+++ b/conio.inc
@@ -1,7 +1,7 @@
 ;; $Id$
 ;; -----------------------------------------------------------------------
 ;;   
-;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2004 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
@@ -109,7 +109,8 @@ msg_putchar:                                    ; Normal character
 msg_normal:    call write_serial_displaymask   ; Write to serial port
                test [DisplayMask],cl
                jz msg_ignore                   ; Not screen
-                mov bx,[TextAttrBX]
+                mov bl,[TextAttribute]
+               mov bh,[BIOS_page]
                 mov ah,09h                      ; Write character/attribute
                 mov cx,1                        ; One character only
                 int 10h                         ; Write to screen
@@ -119,7 +120,7 @@ msg_normal: call write_serial_displaymask   ; Write to serial port
                 ja msg_line_wrap               ; Screen wraparound
                 mov [CursorCol],al
 
-msg_gotoxy:     mov bh,[TextPage]
+msg_gotoxy:     mov bh,[BIOS_page]
                 mov dx,[CursorDX]
                 mov ah,02h                      ; Set cursor position
                 int 10h
@@ -225,7 +226,7 @@ msg_viewimage:
                ; after loading a graphics file
 msg_initvars:
                 pusha
-                mov bh,[TextPage]
+                mov bh,[BIOS_page]
                 mov ah,03h                      ; Read cursor position
                 int 10h
                 mov [CursorDX],dx
index bc1c5b1..9454d66 100644 (file)
--- a/font.inc
+++ b/font.inc
@@ -1,7 +1,7 @@
 ;; $Id$
 ;; -----------------------------------------------------------------------
 ;;   
-;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2004 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
@@ -80,7 +80,6 @@ use_font:
                mov ax,1121h                    ; Set user character table
                int 10h
                mov [VidCols], byte 79          ; Always 80 bytes/line
-               mov [TextPage], byte 0          ; Always page 0
 .lf_ret:       ret                             ; No need to call adjust_screen
 
 .text:
@@ -110,7 +109,6 @@ adjust_screen:
 vidrows_ok:    mov [VidRows],al
                 mov ah,0fh
                 int 10h                         ; Read video state
-                mov [TextPage],bh
                 dec ah                          ; Store count-1 (same as rows)
                 mov [VidCols],ah
                ret
index 086bc5e..028c35a 100644 (file)
@@ -9,7 +9,7 @@
 ;  available.  It is based on the SYSLINUX boot loader for MS-DOS
 ;  floppies.
 ;
-;   Copyright (C) 1994-2002  H. Peter Anvin
+;   Copyright (C) 1994-2004  H. Peter Anvin
 ;
 ;  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
@@ -189,9 +189,6 @@ KernelExtPtr        resw 1                  ; During search, final null pointer
 LocalBootType  resw 1                  ; Local boot return code
 ImageSectors   resw 1                  ; isolinux.bin size, sectors
 DiskSys                resw 1                  ; Last INT 13h call
-TextAttrBX      equ $
-TextAttribute   resb 1                 ; Text attribute for message file
-TextPage        resb 1                 ; Active display page
 CursorDX        equ $
 CursorCol       resb 1                 ; Cursor column for message file
 CursorRow       resb 1                 ; Cursor row for message file
@@ -203,6 +200,7 @@ FlowControl equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
 FlowIgnore     resb 1                  ; Ignore input unless these bits set
+TextAttribute   resb 1                 ; Text attribute for message file
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -1331,7 +1329,7 @@ writechr_full:
                call write_serial       ; write to serial port if needed
                pushfd
                pushad
-               mov bh,[TextPage]
+               mov bh,[BIOS_page]
                push ax
                 mov ah,03h              ; Read cursor position
                 int 10h
@@ -1343,7 +1341,7 @@ writechr_full:
                cmp al,10
                je .lf
                push dx
-                mov bh,[TextPage]
+                mov bh,[BIOS_page]
                mov bl,07h              ; White on black
                mov cx,1                ; One only
                mov ah,09h              ; Write char and attribute
@@ -1356,7 +1354,7 @@ writechr_full:
 .lf:           inc dh
                cmp dh,[VidRows]
                ja .scroll
-.curxyok:      mov bh,[TextPage]
+.curxyok:      mov bh,[BIOS_page]
                mov ah,02h              ; Set cursor position
                int 10h                 
 .ret:          popad
@@ -1364,7 +1362,7 @@ writechr_full:
                pop ds
                ret
 .scroll:       dec dh
-               mov bh,[TextPage]
+               mov bh,[BIOS_page]
                mov ah,02h
                int 10h
                mov ax,0601h            ; Scroll up one line
index 4a9d475..50b5d8e 100644 (file)
@@ -16,7 +16,7 @@
 ;  then the first sector (cluster, really, but we can only assume 1 sector)
 ;  of LDLINUX.SYS at 7E00h and finally the remainder of LDLINUX.SYS at 8000h.
 ;
-;   Copyright (C) 1994-2002  H. Peter Anvin
+;   Copyright (C) 1994-2004  H. Peter Anvin
 ;
 ;  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
@@ -185,9 +185,6 @@ VGAPos              resw 1                  ; Pointer into VGA memory
 VGACluster     resw 1                  ; Cluster pointer for VGA image file
 VGAFilePtr     resw 1                  ; Pointer into VGAFileBuf
 Com32SysSP     resw 1                  ; SP saved during COM32 syscall
-TextAttrBX      equ $
-TextAttribute   resb 1                 ; Text attribute for message file
-TextPage        resb 1                 ; Active display page
 CursorDX        equ $
 CursorCol       resb 1                 ; Cursor column for message file
 CursorRow       resb 1                 ; Cursor row for message file
@@ -199,6 +196,7 @@ FlowControl equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
 FlowIgnore     resb 1                  ; Ignore input unless these bits set
+TextAttribute   resb 1                 ; Text attribute for message file
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -504,13 +502,15 @@ found_it: ; Note: we actually leave two words on the stack here
 ;
 ;
 ; writestr: write a null-terminated string to the console
+;          This assumes we're on page 0.  This is only used for early
+;           messages, so it should be OK.
 ;
 writestr:
 .loop:         lodsb
                and al,al
                 jz .return
                mov ah,0Eh              ; Write to screen as TTY
-               mov bx,0007h            ; White on black, current page
+               mov bx,0007h            ; Attribute
                int 10h
                jmp short .loop
 .return:       ret
@@ -1197,14 +1197,15 @@ dir_return:
 
 ;
 ; writechr:    Write a single character in AL to the console without
-;              mangling any registers
+;              mangling any registers; handle video pages correctly.
 ;
 writechr:
                call write_serial       ; write to serial port if needed
                pushfd
                pushad
                mov ah,0Eh
-               mov bx,0007h            ; white text on this page
+               mov bl,07h              ; attribute
+               mov bh,[cs:BIOS_page]   ; current page
                int 10h
                popad
                popfd
index 03864b5..edc081d 100644 (file)
@@ -8,7 +8,7 @@
 ;  network booting API.  It is based on the SYSLINUX boot loader for
 ;  MS-DOS floppies.
 ;
-;   Copyright (C) 1994-2003  H. Peter Anvin
+;   Copyright (C) 1994-2004  H. Peter Anvin
 ;
 ;  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
@@ -275,9 +275,6 @@ LocalBootType       resw 1                  ; Local boot return code
 RealBaseMem    resw 1                  ; Amount of DOS memory after freeing
 APIVer         resw 1                  ; PXE API version found
 IdleTimer      resw 1                  ; Time to check for ARP?
-TextAttrBX      equ $
-TextAttribute   resb 1                 ; Text attribute for message file
-TextPage        resb 1                 ; Active display page
 CursorDX        equ $
 CursorCol       resb 1                 ; Cursor column for message file
 CursorRow       resb 1                 ; Cursor row for message file
@@ -289,6 +286,7 @@ FlowControl equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
 FlowIgnore     resb 1                  ; Ignore input unless these bits set
+TextAttribute   resb 1                 ; Text attribute for message file
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -1508,7 +1506,7 @@ writechr:
                call write_serial       ; write to serial port if needed
                pushfd
                pushad
-               mov bh,[TextPage]
+               mov bh,[BIOS_page]
                push ax
                 mov ah,03h              ; Read cursor position
                 int 10h
@@ -1520,7 +1518,7 @@ writechr:
                cmp al,10
                je .lf
                push dx
-                mov bh,[TextPage]
+                mov bh,[BIOS_page]
                mov bl,07h              ; White on black
                mov cx,1                ; One only
                mov ah,09h              ; Write char and attribute
@@ -1533,7 +1531,7 @@ writechr:
 .lf:           inc dh
                cmp dh,[VidRows]
                ja .scroll
-.curxyok:      mov bh,[TextPage]
+.curxyok:      mov bh,[BIOS_page]
                mov ah,02h              ; Set cursor position
                int 10h                 
 .ret:          popad
@@ -1541,7 +1539,7 @@ writechr:
                pop ds
                ret
 .scroll:       dec dh
-               mov bh,[TextPage]
+               mov bh,[BIOS_page]
                mov ah,02h
                int 10h
                mov ax,0601h            ; Scroll up one line