Changeset 234


Ignore:
Timestamp:
Jul 7, 2018, 9:09:53 AM (7 years ago)
Author:
Ben Rietbroek
Message:

Updated the charset loading logic [v1.1.5-testing]

This can now inject custom glyphs at any code-point and optionally
remap the original character somewhere else.

For Spanish, two custom CP850 glyphs, 0xb5 and 0xe0, are used.
And the original glyph at code-point 0xb5, which is a box-character that
AiR-BOOT uses, is remapped to code-point 0xd9.

Translator-build 'AiR-BOOT-v1.1.5-ES-TESTBUILD-20180705' was created
from this commit.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.4-manual.pdf

Location:
trunk/bootcode
Files:
1 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/airboot.asm

    r221 r234  
    188188TextChar_WinRep2            equ     0C5h
    189189TextChar_WinRep3            equ     0CFh
    190 TextChar_WinRep4            equ     0B5h
     190
     191; Remap the box-char for Spanish
     192IF  BLD_LANG_TXT EQ 'es'
     193TextChar_WinRep4            equ     0D9h    ; Remapped box-char for ES
     194ELSE
     195TextChar_WinRep4            equ     0B5h    ; Normal box-char
     196ENDIF
     197
    191198TextChar_WinRep5            equ     0C6h
    192199TextChar_WinRep6            equ     0D8h
     
    17901797
    17911798;
    1792 ; Cyrillic support.
    1793 ;
    1794 IFDEF   TXT_IncludeCyrillic
     1799; Extended Charset support.
     1800;
     1801IFDEF   TXT_LoadCharset
    17951802b_ccharset:
    1796    include special/charset.asm  ; Charset Support (e.g. Cyrillic)
     1803   include special/charset.asm  ; Charset Support (RU and ES)
    17971804size_ccharset = $-b_ccharset
    17981805ENDIF
  • trunk/bootcode/regular/other.asm

    r223 r234  
    207207        call    PART_CalculateStraightPartPointers
    208208
    209         ; Setup Cyrillic Charset, if needed
    210     IFDEF TXT_IncludeCyrillic
     209        ; Load charset or glyphs if needed
     210IFDEF TXT_LoadCharset
     211IF  BLD_LANG_TXT EQ 'es'
     212        call    CHARSET_IncludeSpanish
     213ENDIF
     214IF  BLD_LANG_TXT EQ 'ru'
    211215        call    CHARSET_IncludeCyrillic
    212     ENDIF
     216ENDIF
     217ENDIF
    213218
    214219
  • trunk/bootcode/special/charset.asm

    r57 r234  
    2323;  contain special characters that are not included in the Video ROM charset.
    2424
    25 ; May destroy all-purpose registers (AX,BX,CX,DX), will preserve all others
    26 CHARSET_IncludeCyrillic        Proc Near  Uses si di bp
    27    ; First we get the ROM charset from BIOS...
    28    mov    ax, 1130h
    29    mov    bh, 6                          ; Get ROM VGA 25x80 charset
    30    int    10h                            ; VIDEO BIOS: Get charset table pointer
    31    mov    bx, ds                         ; ES:BP point to charset (in Video-ROM)
    32    mov    ax, es
    33    mov    es, bx
    34    mov    ds, ax
    35    mov    si, bp                         ; DS:SI - ROM Font 25x80 and ES==CS
    36    mov    di, offset CharsetTempBuffer
    37    mov    cx, 2048
    38    rep    movsw                          ; Copy ROM-charset to Temp-Buffer
    39    mov    ds, bx                         ; DS==CS
    40    mov    si, offset CHARSET_Cyrillic
    41    mov    di, offset CharsetTempBuffer+2048
    4225
    43    mov    dl, 64                         ; Decode 64 character bitmaps
    44    xor    al, al
    45    xor    ch, ch
    46   DecodeLoop:                            ; This is an uncompressing-loop
    47       mov    ah, ds:[si]
    48       inc    si
    49       mov    cl, ah
    50       and    cl, 0Fh
    51       rep    stosb                       ; Write NULs, count: lower 4 bits
    52       mov    cl, ah
    53       shr    cl, 4
    54       or     cl, cl
    55       jz     EndOfStream
    56       rep    movsb
    57       jmp    DecodeLoop
    58      EndOfStream:
    59       cmp    di, offset CharsetTempBuffer+3840
    60       jae    DecodeDone
    61       add    di, 768                     ; Skip 3x16 char blocks
    62       jmp    DecodeLoop
    63   DecodeDone:
    64     IFDEF   FX_ENABLED
    65         call   FX_WaitRetrace                 ; Wait for retrace to reduce flickering
    66     ENDIF
    67    mov    ax, 1110h
    68    mov    bh, 16
    69    xor    bl, bl
    70    mov    cx, 0FFh
    71    xor    dx, dx
    72    mov    bp, offset CharsetTempBuffer ; ES:BP - New charset
    73    int    10h                            ; VIDEO BIOS: Set new charset table
    74    mov    ah, 12h
    75    mov    bl, 30h
    76    mov    al, 2                          ; 400 ScanLines
    77    int    10h                            ; VIDEO BIOS: Set Scanlines
    78    ret
     26
     27; We are building for Spanish so enable simple glyph injection for a few CP850 glyphs
     28IF  BLD_LANG_TXT EQ 'es'
     29
     30; -----------------------------------------------------------------------------
     31; Load the glyphs used for Spanish into the video-system
     32; -----------------------------------------------------------------------------
     33; Spanish actually currently only uses codepoint 0xb5 from CP850.
     34; However, in CP437, which is used by the BIOS, 0xb5 is a box-char and used for
     35; building the menus. This function remaps stuff so the 0xb5 glyph from CP850
     36; can be displayed.
     37; -----------------------------------------------------------------------------
     38CHARSET_IncludeSpanish  Proc Near
     39
     40        pusha
     41
     42        ; First we get the ROM charset from BIOS...
     43        call    CHARSET_GetRomGlyphs
     44
     45        ; Pointer to table with glyphs using simple injection format
     46        mov     si, offset CHARSET_Spanish
     47
     48        ; Load nr of glyphs to process in CL
     49        cld
     50        lodsb
     51        mov     cl,al
     52        xor     ch,ch
     53
     54    CHARSET_IncludeSpanish_NextGlyph:
     55        lodsw                   ; AL=code-point, if AH<>0 then backup-point
     56        test    ah,ah           ; Copy glyph to backup-point ?
     57        jz      CHARSET_IncludeSpanish_NoBackup
     58
     59        ; Backup glyph to other code-point so it can be used
     60        push    cx              ; Save glyph counter
     61        push    si              ; Save glyph pointer
     62        mov     si,offset CharsetTempBuffer
     63        mov     di,si
     64        mov     dl,al           ; Glyph code-point
     65        xor     dh,dh
     66        shl     dx,4            ; Index in table assuming 16 scan-lines
     67        add     si,dx           ; Make SI point to it
     68        mov     dl,ah           ; Glyph code-point (backup)
     69        xor     dh,dh
     70        shl     dx,4            ; Index in table assuming 16 scan-lines
     71        add     di,dx           ; Make DI point to it (backup)
     72        mov     cx,16           ; Each byte is a scan-line
     73        rep     movsb           ; Backup the glyph
     74        pop     si              ; Restore glyph pointer
     75        pop     cx              ; Restore glyph counter
     76
     77    CHARSET_IncludeSpanish_NoBackup:
     78        mov     di,offset CharsetTempBuffer
     79        mov     dl,al           ; Glyph code-point
     80        xor     dh,dh
     81        shl     dx,4            ; Index in table assuming 16 scan-lines
     82        add     di,dx           ; Make DI point to glyph to be replaced
     83        push    cx              ; Save glyph counter
     84        mov     cx,16           ; Each byte is a scan-line
     85        rep     movsb           ; Insert the new glyph
     86        pop     cx
     87        loop    CHARSET_IncludeSpanish_NextGlyph   ; Next glyph if any
     88
     89        ; Upload the custom charset to the video-adapter
     90        call  CHARSET_SetCutsomGlyphs
     91
     92        popa
     93        ret
     94CHARSET_IncludeSpanish  EndP
     95
     96ENDIF
     97
     98
     99; We are building for Russian so enable compressed glyph injection to load the CP866 glyphs
     100IF  BLD_LANG_TXT EQ 'ru'
     101
     102; -----------------------------------------------------------------------------
     103; Load the glyphs used for Russian into the video-system
     104; -----------------------------------------------------------------------------
     105; Russian uses the Cyrillic glyphs from CP866.
     106; CP866 is box-char compatible with CP437, which is used by the BIOS, so only
     107; the Cyrillic glyps are overlaid the CP437 glyphs.
     108; -----------------------------------------------------------------------------
     109CHARSET_IncludeCyrillic        Proc Near
     110
     111        pusha
     112
     113        ; First we get the ROM charset from BIOS...
     114        call    CHARSET_GetRomGlyphs
     115
     116        ; Pointer to table with glyphs using compressed format
     117        mov    si, offset CHARSET_Cyrillic
     118        mov    di, offset CharsetTempBuffer+2048
     119
     120        mov    dl, 64           ; Decode 64 character bitmaps
     121        xor    al, al
     122        xor    ch, ch
     123        DecodeLoop:             ; This is an uncompressing-loop
     124        mov    ah, ds:[si]
     125        inc    si
     126        mov    cl, ah
     127        and    cl, 0Fh
     128        rep    stosb            ; Write NULs, count: lower 4 bits
     129        mov    cl, ah
     130        shr    cl, 4
     131        or     cl, cl
     132        jz     EndOfStream
     133        rep    movsb
     134        jmp    DecodeLoop
     135        EndOfStream:
     136        cmp    di, offset CharsetTempBuffer+3840
     137        jae    DecodeDone
     138        add    di, 768          ; Skip 3x16 char blocks
     139        jmp    DecodeLoop
     140
     141        DecodeDone:
     142        ; Upload the custom charset to the video-adapter
     143        call  CHARSET_SetCutsomGlyphs
     144
     145        popa
     146        ret
    79147CHARSET_IncludeCyrillic        EndP
     148
     149ENDIF
     150
     151
     152
     153; -----------------------------------------------------------------------------
     154; Load the glyphs to the video-bios assuming 400 scanlines
     155; -----------------------------------------------------------------------------
     156CHARSET_GetRomGlyphs    Proc
     157        mov    ax, 1130h
     158        mov    bh, 6                ; Get ROM VGA 25x80 charset
     159        int    10h                  ; VIDEO BIOS: Get charset table pointer
     160        mov    bx, ds               ; ES:BP point to charset (in Video-ROM)
     161        mov    ax, es
     162        mov    es, bx
     163        mov    ds, ax
     164        mov    si, bp               ; DS:SI - ROM Font 25x80 and ES==CS
     165        mov    di, offset CharsetTempBuffer
     166        mov    cx, 2048
     167        rep    movsw                ; Copy ROM-charset to Temp-Buffer
     168        mov    ds, bx               ; DS==CS
     169        ret
     170CHARSET_GetRomGlyphs    EndP
     171
     172
     173
     174; -----------------------------------------------------------------------------
     175; Load the glyphs to the video-bios assuming 400 scanlines
     176; -----------------------------------------------------------------------------
     177CHARSET_SetCutsomGlyphs Proc
     178IFDEF FX_ENABLED
     179        call    FX_WaitRetrace      ; Wait for retrace to reduce flickering
     180ENDIF
     181        mov     ax, 1110h
     182        mov     bh, 16
     183        xor     bl, bl
     184        mov     cx, 0FFh
     185        xor     dx, dx
     186        mov     bp, offset CharsetTempBuffer    ; ES:BP - New charset
     187        int     10h                 ; VIDEO BIOS: Set new charset table
     188        mov     ah, 12h
     189        mov     bl, 30h
     190        mov     al, 2               ; 400 ScanLines
     191        int     10h                 ; VIDEO BIOS: Set Scanlines
     192        ret
     193CHARSET_SetCutsomGlyphs EndP
  • trunk/bootcode/text/charset-es.asm

    r233 r234  
    1616;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
    1717;
    18 ;------------------------------------------------------------------------------
    19 ;                                                          AiR-BOOT / MBR-TEXT
    20 ; v001 - Russian - by Denis Tazetdinov
    21 ;------------------------------------------------------------------------------
     18;---------------------------------------------------------------------------
     19;                                                  AiR-BOOT / SPANISH CHARS
     20;---------------------------------------------------------------------------
    2221
    23 TXT_LanguageID                equ 'R'
    24 TXT_IncludeCyrillic           equ ON
    2522
    26 ; Those strings are saved within MBR.
    27 ; Total Length maximum 165 chars (include 13,10 (CRs), excluding ending Zeros)
    28 
    29 TXT_ERROR_Attention            db 'AiR-BOOT: !ATTENTION!', 13, 10, 0
    30 TXT_ERROR_CheckCode            db ' - The code', 0
    31 TXT_ERROR_CheckFailed          db ' of AiR-BOOT is not intact anymore.', 13, 10
    32                                db '   Please boot via AiR-BOOT disc to restore AiR-BOOT.', 13, 10
    33                                db '   System halted. Please press RESET.', 0
     23; Glyphs from CP850 for code-points 0xb5 (A with accent) and 0xe0 (O with accent)
     24CHARSET_Spanish:
     25    db 002h                                                                                             ; Number of glyphs in this table
     26    db 0b5h,0d9h,060h,0c0h,010h,038h,06ch,0c6h,0c6h,0feh,0c6h,0c6h,0c6h,0c6h,000h,000h,000h,000h        ; Remap original glyph (box-char) to 0xd9
     27    db 0e0h,000h,018h,030h,000h,07ch,0c6h,0c6h,0c6h,0c6h,0c6h,0c6h,0c6h,07ch,000h,000h,000h,000h        ; No remapping needed
  • trunk/bootcode/text/charset.asm

    r57 r234  
    2020;---------------------------------------------------------------------------
    2121
    22 ifdef TXT_IncludeCyrillic
    23    ; Compressed Cyrillic 866 16x9 charset (1 counter-byte, followed by data)
    24   CHARSET_Cyrillic:
    25    dw 010A2h, 06C38h, 0C6C6h, 0C6FEh, 0C6C6h, 0A6C6h, 0C4FCh, 0C0C0h, 0C6FCh
    26    dw 0C6C6h, 0FCC6h, 0FCA6h, 0C6C6h, 0F8CCh, 0C6CCh, 0C6C6h, 0A6FCh, 0C2FEh
    27    dw 0C0C0h, 0C0C0h, 0C0C0h, 0C0C0h, 03EB6h, 03636h, 03636h, 06636h, 06666h
    28    dw 0C3FFh, 0FEA5h, 0C0C2h, 0F8C0h, 0C0C0h, 0C2C0h, 0A6FEh, 0D6D6h, 05454h
    29    dw 0547Ch, 05454h, 0D6D6h, 07CA6h, 086C6h, 03C06h, 00606h, 0C686h, 0A67Ch
    30    dw 0CEC6h, 0FEDEh, 0E6F6h, 0C6C6h, 0C6C6h, 06CC4h, 0C638h, 0DECEh, 0F6FEh
    31    dw 0C6E6h, 0C6C6h, 0A6C6h, 0C6C6h, 0D8CCh, 0F0F0h, 0CCD8h, 0C6C6h, 07EA6h
    32    dw 06666h, 06666h, 06666h, 0C666h, 0A6C6h, 0EEC6h, 0FEFEh, 0C6D6h, 0C6C6h
    33    dw 0C6C6h, 0C6A6h, 0C6C6h, 0FEC6h, 0C6C6h, 0C6C6h, 0A6C6h, 0C67Ch, 0C6C6h
    34    dw 0C6C6h, 0C6C6h, 07CC6h, 0FEA6h, 0C6C6h, 0C6C6h, 0C6C6h, 0C6C6h, 0A6C6h
    35    dw 0C6FCh, 0C6C6h, 0FCC6h, 0C0C0h, 0C0C0h, 03CA6h, 0C266h, 0C0C0h, 0C0C0h
    36    dw 066C2h, 0A63Ch, 05A7Eh, 01818h, 01818h, 01818h, 01818h, 0C6A6h, 0C6C6h
    37    dw 06EC6h, 0383Ch, 0E070h, 0A6C0h, 01038h, 0D67Ch, 09292h, 07CD6h, 03810h
    38    dw 0C6A6h, 06CC6h, 0387Ch, 07C38h, 0C66Ch, 0C6C6h, 0CCCCh, 0CCCCh, 0CCCCh
    39    dw 0CCCCh, 0FCCCh, 00606h, 0C6A4h, 0C6C6h, 0C6C6h, 006FEh, 00606h, 0A606h
    40    dw 0D6D6h, 0D6D6h, 0D6D6h, 0D6D6h, 0FED6h, 0D6C6h, 0D6D6h, 0D6D6h, 0D6D6h
    41    dw 0D6D6h, 006FEh, 0A406h, 0B0F0h, 03CB0h, 0333Eh, 03333h, 03C3Eh, 0C3A6h
    42    dw 0C3C3h, 0FBF3h, 0CBCBh, 0FBCBh, 0A6F3h, 06060h, 07860h, 0667Ch, 06666h
    43    dw 0787Ch, 078A6h, 086CCh, 03E06h, 00606h, 0CC86h, 0A678h, 0DFCEh, 0DBDBh
    44    dw 0FBFBh, 0DBDBh, 0CEDFh, 03EA6h, 0C666h, 03E66h, 06636h, 0C666h, 079C6h
    45    dw 0063Ch, 0663Eh, 06666h, 0A63Ah, 07C04h, 0F8C0h, 0CCCCh, 0CCCCh, 078CCh
    46    dw 07C79h, 06666h, 0667Ch, 07C66h, 07E79h, 06062h, 06060h, 06060h, 03C89h
    47    dw 02C2Ch, 04C6Ch, 07C4Ch, 078C6h, 0663Ch, 07E66h, 06660h, 0793Ch, 054D6h
    48    dw 0387Ch, 0547Ch, 079D6h, 0C67Ch, 03C06h, 0C606h, 0797Ch, 0CEC6h, 0F6DEh
    49    dw 0C6E6h, 0A6C6h, 03828h, 0C610h, 0DECEh, 0E6F6h, 0C6C6h, 06679h, 0786Ch
    50    dw 06C78h, 06666h, 03E79h, 03636h, 03636h, 06676h, 0C679h, 0FEEEh, 0C6D6h
    51    dw 0C6C6h, 06679h, 06666h, 0667Eh, 06666h, 03C79h, 06666h, 06666h, 03C66h
    52    dw 07E79h, 06666h, 06666h, 06666h, 09504h
    53    db 07Ch
    54    dw 06666h, 06666h, 0607Ch, 06060h, 03E77h, 06062h, 06060h, 03E62h, 07E79h
    55    dw 01818h, 01818h, 01818h, 06699h, 06666h, 03E66h, 0181Ch, 06070h, 03886h
    56    dw 07C10h, 0D6D6h, 0107Ch, 07938h, 06CC6h, 03838h, 06C38h, 099C6h, 0CCCCh
    57    dw 0CCCCh, 0CCCCh, 006FEh, 07706h, 0C6C6h, 0C6C6h, 006FEh, 07906h, 0D6D6h
    58    dw 0D6D6h, 0D6D6h, 099FEh, 0D6D6h, 0D6D6h, 0D6D6h, 006FEh, 07706h, 0B0F0h
    59    dw 03CB0h, 03636h, 0793Ch, 0C6C6h, 0F6C6h, 0D6D6h, 079F6h, 06060h, 07860h
    60    dw 06C6Ch, 07978h, 0663Ch, 00E06h, 06606h, 0793Ch, 0D6CCh, 0F6D6h, 0D6D6h
    61    dw 079CCh, 0663Eh, 03E66h, 06636h, 00466h
    62 endif
     22
     23; Check if extended glyphs need to be loaded.
     24; Both use a different algorithm because for ES only one char is needed while
     25; for RU the cyrillic chars are loaded. Code is 'bootcode/special/charset.asm'.
     26IFDEF TXT_LoadCharset
     27
     28; Spanish (cp850)
     29IF  BLD_LANG_TXT EQ 'es'
     30        include charset-es.asm
     31ENDIF
     32
     33; Russian (cp866)
     34IF  BLD_LANG_TXT EQ 'ru'
     35   include charset-ru.asm
     36ENDIF
     37
     38ENDIF
  • trunk/bootcode/text/ru/mbr.asm

    r57 r234  
    2222
    2323TXT_LanguageID                equ 'R'
    24 TXT_IncludeCyrillic           equ ON
     24TXT_LoadCharset               equ ON
    2525
    2626; Those strings are saved within MBR.
Note: See TracChangeset for help on using the changeset viewer.