Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9b2e20c in mainline


Ignore:
Timestamp:
2021-08-25T13:59:41Z (3 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
e3d0a44, ff6e91b
Parents:
c21cc26
git-author:
Jiri Svoboda <jiri@…> (2021-08-24 17:59:34)
git-committer:
Jiri Svoboda <jiri@…> (2021-08-25 13:59:41)
Message:

Add code page 437 support

EGA driver can now display all 256 characters (provided that the
application uses their proper Unicode code points).

Tester print4 'extended ASCII' demonstration did not work since
the introduction of Unicode, so replaced it with a demonstration
of code page 437 instead.

Location:
uspace
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/meson.build

    rc21cc26 r9b2e20c  
    11#
     2# Copyright (c) 2021 Jiri Svoboda
    23# Copyright (c) 2005 Martin Decky
    34# Copyright (c) 2007 Jakub Jermar
     
    2829#
    2930
    30 deps = [ 'block', 'drv', 'math' ]
     31deps = [ 'block', 'codepage', 'drv', 'math' ]
    3132src = files(
    3233        'tester.c',
  • uspace/app/tester/print/print4.c

    rc21cc26 r9b2e20c  
    11/*
     2 * Copyright (c) 2021 Jiri Svoboda
    23 * Copyright (c) 2009 Martin Decky
    34 * All rights reserved.
     
    2728 */
    2829
     30#include <codepage/cp437.h>
    2931#include <stdio.h>
    3032#include <stddef.h>
     
    5153        }
    5254
    53         TPRINTF("\nExtended ASCII characters (128 - 255) using printf(\"%%lc\"):\n");
     55        /*
     56         * Print entire code page 437 (in Unicode)
     57         *
     58         * The purpose of this test is to verify that the EGA display
     59         * driver can correctly map every code page 437 character back
     60         * from Unicode and display it.
     61         *
     62         * With a Unicode-capable display this will just give you a bit
     63         * of nostalgia.
     64         */
     65        TPRINTF("\nCode page 437 characters (converted to Unicode):\n");
    5466
    55         for (group = 4; group < 8; group++) {
     67        for (group = 0; group < 8; group++) {
    5668                TPRINTF("%#x: ", group << 5);
    5769
    5870                uint8_t index;
    5971                for (index = 0; index < 32; index++)
    60                         TPRINTF("%lc", (wint_t) ((group << 5) + index));
     72                        TPRINTF("%lc", cp437_decode((group << 5) + index));
    6173
    6274                TPRINTF("\n");
  • uspace/lib/meson.build

    rc21cc26 r9b2e20c  
    5757        'block',
    5858        'clui',
     59        'codepage',
    5960        'compress',
    6061        'cpp',
  • uspace/srv/hid/output/meson.build

    rc21cc26 r9b2e20c  
    2828#
    2929
    30 deps = [ 'drv', 'fbfont', 'pixconv', 'ddev' ]
     30deps = [ 'codepage', 'drv', 'fbfont', 'pixconv', 'ddev' ]
    3131src = files(
    3232        'ctl/serial.c',
  • uspace/srv/hid/output/port/ega.c

    rc21cc26 r9b2e20c  
    11/*
     2 * Copyright (c) 2021 Jiri Svoboda
    23 * Copyright (c) 2011 Martin Decky
    34 * All rights reserved.
     
    3132 */
    3233
     34#include <codepage/cp437.h>
    3335#include <errno.h>
    3436#include <sysinfo.h>
     
    106108{
    107109        uint8_t glyph;
    108 
    109         if (ascii_check(field->ch))
    110                 glyph = field->ch;
    111         else
     110        errno_t rc;
     111
     112        rc = cp437_encode(field->ch, &glyph);
     113        if (rc != EOK)
    112114                glyph = '?';
    113115
Note: See TracChangeset for help on using the changeset viewer.