diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-01-25 17:23:32 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-01-25 17:23:32 -0800 |
commit | 582645e269ee82d544ab8b8b913c8364f3178484 (patch) | |
tree | 52f2627071926f3c2162643a0f57c1387627e36e /core/ldlinux.asm | |
parent | 4b533a0066a26b82c36d58af05c3bbeabf7e3b95 (diff) | |
download | syslinux-582645e269ee82d544ab8b8b913c8364f3178484.tar.gz |
Reorganize the codepage handling to allow ucs2 -> codepage conversion
Reorganize the codepage handling to make it easier to do ucs2 ->
codepage conversion, this will be used for a future directory lister.
Diffstat (limited to 'core/ldlinux.asm')
-rw-r--r-- | core/ldlinux.asm | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/core/ldlinux.asm b/core/ldlinux.asm index c7f6577c..e9d0573f 100644 --- a/core/ldlinux.asm +++ b/core/ldlinux.asm @@ -100,7 +100,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 @@ -1040,10 +1041,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 @@ -1170,8 +1171,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 |