Browse Source

start hacky experiment to support combining chars

https://en.wikipedia.org/wiki/Combining_character

The plan: just draw the combining character in the same space as the
previous character. This will almost certainly not work for some Unicode
blocks (tibetan?)

This commit only changes the data/memory/disk model to make some space.
As always in Mu, we avoid bit-mask tricks even if that wastes memory.
main
Kartik K. Agaram 10 months ago
parent
commit
b8afd4becf
  1. 5
      103glyph.subx
  2. 2
      boot.subx
  3. 4355
      font.subx
  4. 14
      translate
  5. 14
      translate_emulated

5
103glyph.subx

@ -87,12 +87,13 @@ draw-code-point-on-screen-buffer: # buffer: (addr byte), c: code-point, x: int,
81 7/subop/compare %esi 0x1100/imm32/4352
0f 8d/jump-if->= $draw-code-point-on-screen-buffer:end/disp32
# var letter-bitmap/esi = font[c]
69/multiply %esi 0x21/imm32/glyph-size 6/r32/esi
69/multiply %esi 0x22/imm32/glyph-size 6/r32/esi
81 0/subop/add %esi 0x0010000c/imm32/Font # see boot.subx
# dispatch based on letter-bitmap->size
b8/copy-to-eax 0/imm32
8a/byte-> *esi 0/r32/AL
46/increment-esi # skip size
46/increment-esi # skip size
3d/compare-eax-and 8/imm32
{
75/jump-if-!= break/disp8
@ -120,7 +121,7 @@ wide-code-point?: # c: code-point -> _/eax: boolean
3d/compare-eax-and 0x80/imm32
0f 8d/jump-if->= $wide-code-point?:end/disp32
# var letter-bitmap/eax = font[c]
69/multiply %eax 0x21/imm32/glyph-size 0/r32/eax
69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
05/add-to-eax 0x0010000c/imm32/Font # see boot.subx
# dispatch based on letter-bitmap->size
8a/byte-> *eax 0/r32/AL

2
boot.subx

@ -280,7 +280,7 @@ initialize_32bit_mode:
c7 0/subop/copy *0x00100000 0/imm32/read
c7 0/subop/copy *0x00100004 0/imm32/write
c7 0/subop/copy *0x00100008 0x00e00000/imm32/size
(load-sectors Primary-bus-primary-drive 0x2328 0x120 0x00100000) # source 0x2328 = sector 9000 on disk, destination 0x00100000
(load-sectors Primary-bus-primary-drive 0x2328 0x200 0x00100000) # source 0x2328 = sector 9000 on disk, destination 0x00100000
# Font is now loaded starting at 0x0010000c.
## load interrupt handlers

4355
font.subx

File diff suppressed because it is too large Load Diff

14
translate

@ -7,7 +7,7 @@ set -e
export DISK=20160 # 20*16*63 512-byte sectors = almost 10MB
dd if=/dev/zero of=code.img count=$DISK status=none
# code: sectors 0-8999
# font: sectors 9000-10079 (1080 sectors = space enough for 16k glyphs (1080 * 512 / 33 bytes per glyph))
# font: sectors 9000-10079 (1080 sectors = space enough for 16k glyphs (1080 * 512 / 34 bytes per glyph))
export FONT=9000 # keep this sync'd with boot.subx
# debug: sector 10080 onwards
export DEBUG=10080
@ -74,6 +74,18 @@ dd if=labels of=code.img seek=$DEBUG conv=notrunc status=none # keep this sync'
## Font data at another well-defined location
cat font.subx |sed 's,/[^ ]*,,' |linux/hex > a.font
if [ `stat --printf="%s" a.font` -ge 262144 ] # 0x200 sectors * 512 bytes per sector (keep this sync'd with boot.subx)
then
echo "font won't all be loaded on boot"
exit 1
fi
if [ `stat --printf="%s" a.font` -ge 14680064 ] # 0x00e00000 = 0x00f00000 - 0x00100000
then
echo "font is so large it overlaps the ISA memory hole; see https://wiki.osdev.org/Memory_Map_(x86)"
exit 1
fi
if [ `stat --printf="%s" a.font` -ge $(( ($DEBUG - $FONT) * 512 )) ]
then
echo "font will overwrite debug info in disk"

14
translate_emulated

@ -11,7 +11,7 @@ set -v
export DISK=20160 # 20*16*63 512-byte sectors = almost 10MB
dd if=/dev/zero of=code.img count=$DISK status=none
# code: sectors 0-8999
# font: sectors 9000-10079 (1080 sectors = space enough for 16k glyphs (1080 * 512 / 33 bytes per glyph))
# font: sectors 9000-10079 (1080 sectors = space enough for 16k glyphs (1080 * 512 / 34 bytes per glyph))
export FONT=9000 # keep this sync'd with boot.subx
# debug: sector 10080 onwards
export DEBUG=10080
@ -78,6 +78,18 @@ dd if=labels of=code.img seek=$DEBUG conv=notrunc status=none # keep this sync'
## Font data at another well-defined location
cat font.subx |sed 's,/[^ ]*,,' |linux/hex > a.font
if [ `stat --printf="%s" a.font` -ge 262144 ] # 0x200 sectors * 512 bytes per sector (keep this sync'd with boot.subx)
then
echo "font won't all be loaded on boot"
exit 1
fi
if [ `stat --printf="%s" a.font` -ge 14680064 ] # 0x00e00000 = 0x00f00000 - 0x00100000
then
echo "font is so large it overlaps the ISA memory hole; see https://wiki.osdev.org/Memory_Map_(x86)"
exit 1
fi
if [ `stat --printf="%s" a.font` -ge $(( ($DEBUG - $FONT) * 512 )) ]
then
echo "font will overwrite debug info in disk"

Loading…
Cancel
Save