aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-02-10 22:17:12 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-02-10 22:17:12 -0800
commitd379e8c25b29794798395bf024f1c31c24bcb385 (patch)
tree98cbd5eecb0df2fcfefa1b070b0d6b8039652a2a
parent3d17ee8d11838b6380818f144ed04c188c775df5 (diff)
parent582645e269ee82d544ab8b8b913c8364f3178484 (diff)
downloadsyslinux-elf-d379e8c25b29794798395bf024f1c31c24bcb385.tar.gz
syslinux-elf-d379e8c25b29794798395bf024f1c31c24bcb385.tar.xz
syslinux-elf-d379e8c25b29794798395bf024f1c31c24bcb385.zip
Merge branch 'charset' into dir
-rwxr-xr-xcodepage/cptable.pl5
-rw-r--r--core/ldlinux.asm28
2 files changed, 29 insertions, 4 deletions
diff --git a/codepage/cptable.pl b/codepage/cptable.pl
index c7e20023..05cfc3eb 100755
--- a/codepage/cptable.pl
+++ b/codepage/cptable.pl
@@ -118,6 +118,7 @@ for ($i = 0; $i < 256; $i++) {
# Unicode (longname) matching table.
# This only depends on the console codepage.
#
+$pp0 = ''; $pp1 = '';
for ($i = 0; $i < 256; $i++) {
if (!defined($ytab[$i])) {
$p0 = $p1 = 0xffff;
@@ -136,8 +137,10 @@ for ($i = 0; $i < 256; $i++) {
# Only the BMP is supported...
$p0 = 0xffff if ($p0 > 0xffff);
$p1 = 0xffff if ($p1 > 0xffff);
- print CPOUT pack("vv", $p0, $p1);
+ $pp0 .= pack("v", $p0);
+ $pp1 .= pack("v", $p1);
}
+print CPOUT $pp0, $pp1;
close (CPOUT);
diff --git a/core/ldlinux.asm b/core/ldlinux.asm
index 61ce1a0e..29f3b3b4 100644
--- a/core/ldlinux.asm
+++ b/core/ldlinux.asm
@@ -105,7 +105,8 @@ file_left resd 1 ; Number of sectors left
.magic resd 2 ; 8-byte magic number
.reserved resd 6 ; Reserved for future use
.uppercase resb 256 ; Internal upper-case table
-.unicode resw 2*256 ; Unicode matching table
+.unicode resw 256 ; Unicode matching table
+.unicode_alt resw 256 ; Alternate Unicode matching table
endstruc
%ifndef DEPEND
@@ -1097,10 +1098,10 @@ search_dos_dir:
cmp bx,[NameLen]
jae .vfat_tail
movzx bx,byte [bx+di]
- shl bx,2
+ add bx,bx
cmp ax,[cp_unicode+bx] ; Primary case
je .ucs_ok
- cmp ax,[cp_unicode+bx+2] ; Alternate case
+ cmp ax,[cp_unicode_alt+bx] ; Alternate case
je .ucs_ok
; Mismatch...
jmp .not_us_pop
@@ -1227,8 +1228,29 @@ codepage equ $-(32+32)
codepage_data: incbin "codepage.cp",32+32
cp_uppercase equ codepage+cp.uppercase
cp_unicode equ codepage+cp.unicode
+cp_unicode_alt equ codepage+cp.unicode_alt
codepage_end equ $
+ section .text
+;
+; Input: UCS-2 character in AX
+; Output: Single byte character in AL, ZF = 1
+; On failure, returns ZF = 0
+;
+; Assumes CS == ES == 0.
+;
+ucs2_to_cp:
+ push di
+ push cx
+ mov di,cp_unicode
+ mov cx,512
+ repne scasw
+ xchg ax,cx
+ pop cx
+ pop di
+ not ax ; Doesn't change the flags!
+ ret
+
section .bss
VFATInit resb 1
VFATNext resb 1