Skip to content

Commit 17e2354

Browse files
committed
Marginally speed up the tty, but using eight-bit aligned font data rather than
trying to pack it cleverly. Doesn't appear to make a noticeable difference in real life, sadly.
1 parent fff8e21 commit 17e2354

File tree

2 files changed

+15
-62
lines changed

2 files changed

+15
-62
lines changed

arch/nc200/supervisor/tty.inc

+9-41
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ tty_rawwrite:
288288
ld e, a
289289
ld d, 0
290290
add hl, de ; hl = a*4 + a = a*5
291+
add hl, de ; hl = a*5 + a = a*6
292+
add hl, de ; hl = a*6 + a = a*7
291293
ld de, FONT
292294
add hl, de
293295
; hl points at font data
@@ -296,53 +298,18 @@ tty_rawwrite:
296298

297299
ld a, (hl) ; XXXXX???.????????
298300
call draw_single_scanline
299-
300-
ld b, (hl) ; ?????XXX.XX??????
301-
inc hl
302-
ld a, (hl)
303-
srl b
304-
rra
305-
srl b
306-
rra
307-
srl b
308-
rra
301+
ld a, (hl) ; XXXXX???.????????
309302
call draw_single_scanline
310-
311-
ld a, (hl) ; ??XXXXX?
312-
add a, a
313-
add a, a
303+
ld a, (hl) ; XXXXX???.????????
314304
call draw_single_scanline
315-
316-
ld a, (hl) ; ???????X.XXXX????
317-
srl a
318-
inc hl
319-
ld a, (hl)
320-
rra
305+
ld a, (hl) ; XXXXX???.????????
321306
call draw_single_scanline
322-
323-
ld a, (hl) ; ????XXXX.X???????
324-
inc hl
325-
ld b, (hl)
326-
sll b
327-
rla
328-
add a, a
329-
add a, a
330-
add a, a
307+
ld a, (hl) ; XXXXX???.????????
331308
call draw_single_scanline
332-
333-
ld a, (hl) ; ?XXXXX??
334-
add a, a
309+
ld a, (hl) ; XXXXX???.????????
335310
call draw_single_scanline
336-
337-
ld b, (hl) ; ??????XX.XXX?????
338-
inc hl
339-
ld a, (hl)
340-
srl b
341-
rra
342-
srl b
343-
rra
311+
ld a, (hl) ; XXXXX???.????????
344312
; fall through
345-
346313
; On entry, the font data is in A, left justified.
347314
; Font pointer is in HL.
348315
draw_single_scanline:
@@ -392,6 +359,7 @@ scanline_shift_amount:
392359
ld (L_cursor_address), hl
393360

394361
ex de, hl ; put font pointer back in HL
362+
inc hl ; advance to next byte of font data
395363
ret
396364

397365
; vim: sw=4 ts=4 expandtab ft=asm

arch/nc200/utils/fontconvert.c

+6-21
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,18 @@ int main(int argc, const char* argv[])
3737
/* The glyph data is a 7-element array of bytes. Each byte contains
3838
* one scanline, left justified. */
3939

40-
uint64_t mask = 0;
41-
const uint8_t* p = glyph->data;
42-
40+
printf("\tdb ");
4341
int yy = 0;
42+
const uint8_t* p = glyph->data;
4443
while (yy < LINEHEIGHT)
4544
{
46-
/* We assume the right-most column is blank, and so only store five bits. */
47-
48-
mask = (mask << 5) | ((*p >> 3) & 0x1f);
45+
if (yy != 0)
46+
printf(", ");
47+
printf("0x%02x", *p);
4948
p++;
5049
yy++;
5150
}
52-
53-
/* The encoding expects 8 5-bit values in five bytes, *left* justified. */
54-
while (yy < 8)
55-
{
56-
mask <<= 5;
57-
yy++;
58-
}
59-
60-
printf("\tdb 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x ; char %d\n",
61-
(uint32_t)((mask >> 32) & 0xff),
62-
(uint32_t)((mask >> 24) & 0xff),
63-
(uint32_t)((mask >> 16) & 0xff),
64-
(uint32_t)((mask >> 8) & 0xff),
65-
(uint32_t)(mask & 0xff),
66-
c);
51+
printf(" ; char %d\n", c);
6752
}
6853

6954
return 0;

0 commit comments

Comments
 (0)