diff options
| author | hpa <hpa> | 2001-04-19 00:50:29 +0000 |
|---|---|---|
| committer | hpa <hpa> | 2001-04-19 00:50:29 +0000 |
| commit | e41d512f3e23b32c461115b03ecd376bc410a3ed (patch) | |
| tree | 240731b3eff8abb181f61e6264bd9c0603be8ce8 /ldlinux.asm | |
| parent | fccffd5baf99fd53c4d8880eecb89b0617fb0658 (diff) | |
| download | syslinux-e41d512f3e23b32c461115b03ecd376bc410a3ed.tar.gz | |
Introduce a way to return to text mode. Clean up the handling of
mode transitions.
Diffstat (limited to 'ldlinux.asm')
| -rw-r--r-- | ldlinux.asm | 117 |
1 files changed, 65 insertions, 52 deletions
diff --git a/ldlinux.asm b/ldlinux.asm index d8c717c9..78329f8b 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -2940,25 +2940,7 @@ dir_success: mov bx,ax or bx,dx ; Sets ZF iff DX:AX is zero dir_return: - ret - -; -; adjust_screen: Set the internal variables associated with the screen size. -; This is a subroutine in case we're loading a custom font. -; -adjust_screen: - mov al,[BIOS_vidrows] - and al,al - jnz vidrows_is_ok - mov al,24 ; No vidrows in BIOS, assume 25 - ; (Remember: vidrows == rows-1) -vidrows_is_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 -bf_ret: ret +lf_ret: ret ; ; loadfont: Load a .psf font file and install it onto the VGA console @@ -2972,43 +2954,42 @@ loadfont: mov ax,[trackbuf] ; Magic number cmp ax,0436h - jne bf_ret + jne lf_ret mov al,[trackbuf+2] ; File mode cmp al,5 ; Font modes 0-5 supported - ja bf_ret + ja lf_ret mov bh,byte [trackbuf+3] ; Height of font cmp bh,2 ; VGA minimum - jb bf_ret + jb lf_ret cmp bh,32 ; VGA maximum - ja bf_ret + ja lf_ret ; Copy to font buffer mov si,trackbuf+4 ; Start of font data mov [VGAFontSize],bh mov di,vgafontbuf - mov bp,di ; Address of font data for INT 10h mov cx,(32*256) >> 2 ; Maximum size rep movsd - xor bl,bl ; Needed by both INT 10h calls - cmp [UsingVGA], byte 1 ; Are we in graphics mode? - je .graphics - - mov cx,256 - xor dx,dx - mov ax,1110h - int 10h ; Load into VGA RAM + ; Fall through to use_font - xor bl,bl - mov ax,1103h ; Select page 0 - int 10h +; +; use_font: +; This routine activates whatever font happens to be in the +; vgafontbuf, and updates the adjust_screen data. +; +use_font: + mov bp,vgafontbuf + mov bh,[VGAFontSize] - jmp short adjust_screen + xor bl,bl ; Needed by both INT 10h calls + cmp [UsingVGA], byte 1 ; Are we in graphics mode? + jne .text .graphics: - ; CX = 0 on entry + xor cx,bx mov cl,bh ; CX = bytes/character mov ax,480 div cl ; Compute char rows per screen @@ -3017,9 +2998,40 @@ loadfont: mov [VidRows],al mov ax,1121h ; Set user character table int 10h - ; VidCols = 80, TextPage = 0 set by graphics mode select + mov [VidRows], byte 79 ; Always 80 bytes/line + mov [TextPage], byte 0 ; Always page 0 ret ; No need to call adjust_screen +.text: + mov cx,256 + xor dx,dx + mov ax,1110h + int 10h ; Load into VGA RAM + + xor bl,bl + mov ax,1103h ; Select page 0 + int 10h + + ; Fall through to adjust_screen + +; +; adjust_screen: Set the internal variables associated with the screen size. +; This is a subroutine in case we're loading a custom font. +; +adjust_screen: + mov al,[BIOS_vidrows] + and al,al + jnz vidrows_is_ok + mov al,24 ; No vidrows in BIOS, assume 25 + ; (Remember: vidrows == rows-1) +vidrows_is_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 + ; ; loadkeys: Load a LILO-style keymap; SI and DX:AX set by searchdir ; @@ -3097,6 +3109,8 @@ msg_putchar: ; Normal character je msg_newline cmp al,0Ch ; <FF> = clear screen je msg_formfeed + cmp al,19h ; <EM> = return to text mode + je near msg_novga cmp al,18h ; <CAN> = VGA filename follows je near msg_vga jnb .not_modectl @@ -3200,6 +3214,10 @@ msg_setvgafileptr: mov [VGAFilePtr],di msg_ret: ret +msg_novga: + call vgaclearmode + jmp short msg_initvars + msg_viewimage: push es push ds @@ -4085,19 +4103,7 @@ vgasetmode: int 10h mov [UsingVGA], byte 1 - mov [VidCols], byte 79 ; Always 80 chars/screen - mov [TextPage], byte 0 ; Always page 0 - - mov cx,[VGAFontSize] - mov ax,480 - div cl - mov dl,al - dec al ; VidRows is stored -1 - mov [VidRows],al - mov bp,vgafontbuf - xor bx,bx - mov ax,1121h ; Set graphics font - int 10h + call use_font ; Set graphics font/data mov byte [ScrollAttribute], 00h xor ax,ax ; Set ZF @@ -4109,17 +4115,24 @@ vgasetmode: ; Disable VGA graphics. It is not safe to assume any value for DS. ; vgaclearmode: + push ds + push cs + pop ds ; DS <- CS pushad - cmp [cs:UsingVGA], byte 1 + cmp [UsingVGA], byte 1 jne .done mov ax,0003h ; Return to normal video mode int 10h ; mov dx,TextColorReg ; Restore color registers ; mov ax,1002h ; int 10h + + + call use_font ; Restore text font/data mov byte [ScrollAttribute], 07h .done: popad + pop ds ret ; |
