Enterprise Forever

:UK => Programming => Topic started by: elmer on 2020.November.21. 19:59:02

Title: Changing the EXOS font
Post by: elmer on 2020.November.21. 19:59:02
One of the things that I always found interesting about the 8-bit era of computers is the difference in every machine's system font that either helped, or hurt, the readability of the text on the screen.

Because nearly all computers used an 8-pixel high font, each computer's designers had to choose whether to make their upper-case characters either 6 or 7 pixels high, depending upon whether they wanted the character shapes to look nicer (by using 7-pixel height), or whether they wanted to avoid the descenders of the "gpqy" characters hitting the tops of many upper-case characters on the line below (by using 6-pixel height).

One of the unusual, and really great, things about the Enterprise is that it has a 9-pixel high system font that could have allowed it to use both the nicer 7-pixel height for upper-case characters, and to still avoid the unpleasant look of having descenders hit the top of the upper-case characters on the line below.

Unfortunately, whoever it was at Intelligent Software that designed the font, didn't actually do that ... which is something that I always found annoying when I was using my Enterprise back in the 1980s.


Now that I am using EXOS 2.4, and can program my own EXOS EPROM, I decided to fix that, and to also modify a few other characters to make them look a little nicer (in my own personal opinion).


Long time Enterprise programmers will probably already know that the system font is stored compressed in the EXOS ROM, so I had to figure out how this worked, and then figure out how to patch the code to alter the compression a bit, and to then compress the new font into the same 630 byte memory space that the old font fits in ($E5D2-$E847 in EXOS 2.1).


Anyway, here is the result, showing the original EXOS 2.1 font on the left, and my updated font on the right.  The changes are easiest to see on the Hungarian version of Zozo's RAM test, but the Spanish and German versions also look better (to me).

[attach=1]

Since "beauty is in the eye of the beholder", I understand that few people here may be interested in using this themselves, but if anyone is curious, I can post the source code for font-decoding patch, and for the utility that I wrote (on the PC) to apply the patch (and the font) to Zozo's EXOS 2.4 ROMs.

For editing bitmapped-fonts, I recommend that folks use Fony (http://hukka.ncn.fi/?fony), because it is easy to use, and can export the font as raw binary data.
Title: Re: Changing the EXOS font
Post by: gflorez on 2020.November.21. 20:40:16
Great initiative!

But... the character font goes on the keyboard driver, and the BRD.Rom and derivatives install modified Keyboard and Editor drivers, that come with an English(USA) and localised copies of the font... fortunately not packed.

It is very easy to found the two fonts in the Rom if you know what to search for.

On the other way, your technique can serve for the fixing of a German keyboard Enterprise without the need of the language Rom, because it is annoying to search punctuation on the wrong keyboard.... But also the position of the keys need to be changed, and that information is near the font.

Zozo plans to fix it on the next EXOS reincarnation but then the list of different EXOS roms will grow. The Spanish keyboard is similar to the German one, so I am wiling to have one German EP to try that.
Title: Re: Changing the EXOS font
Post by: elmer on 2020.November.21. 22:16:21
But... the character font goes on the keyboard driver, and the BRD.Rom and derivatives install modified Keyboard and Editor drivers, that come with an English(USA) and localised copies of the font... fortunately not packed.

Thanks, I had not checked out the BRD.rom/ESP.rom/HUN.rom language extensions, and so didn't see that they changed some characters in the font! :oops:

But those language ROMs don't actually redefine all of the characters in the font, they rely on the base font that is built into EXOS, and then they change just a few of the character definitions.

So it will be easy to modify those three language ROMs and just define different character designs that take advantage of the lower baseline in my modified font ... it is probably only a few hours of work. :cool:
Title: Re: Changing the EXOS font
Post by: gflorez on 2020.November.22. 01:33:57
There is one variation of the Spanish Rom, the ESB.Rom, made for the German keyboard, that you can also find on the emulator installation. On it, the English/USA layout on the Rom  has been replaced by an "European" QWERTY  layout with all the same "English" characters but in its corrected "German" position. And the Spanish keyboard in the Rom is also a QWERTY one with the "European" layout, so you always find the punctuation symbols.


The language Rom adds a lot of flexibility adapting the Enterprise to a language/country, with the dual messages and keyboards. But is also a great example of the expandability of the Enterprise, how a new driver can substitute the stock driver and the machine works the same.
Title: Re: Changing the EXOS font
Post by: elmer on 2020.November.22. 04:26:01
So it will be easy to modify those three language ROMs and just define different character designs that take advantage of the lower baseline in my modified font ... it is probably only a few hours of work. :cool:

Done!

I'll send you a PM with some ROMs to try. :mrgreen:
Title: Re: Changing the EXOS font
Post by: elmer on 2020.November.23. 21:35:21
After some great feedback from @gflorez, I have made some more modifications to my font, and have gone back to using the Enterprise's very distinct narrow designs for capital 'I' and small 'l' ... which meant changing some other designs to keep all of the charcters balanced.

There are also a few cleanups on some of the punctuation characters.

This should make the new font more comfortable and familiar-looking to people, while still making it easier to read, especially when using 80-column mode, or when typing characters with accents.

Here are all of the patched EXOS 2.4 ROMs ...
Title: Re: Changing the EXOS font
Post by: elmer on 2020.November.23. 21:39:57
And here are the latest font files ...
Title: Re: Changing the EXOS font
Post by: elmer on 2020.November.29. 19:48:14
While most programs look a LOT better to me with the new font, and especially the more-readable accents, there are a couple of programs that I have seen that do not work well with the lower baseline of the new font, such as IS-FORTH and IS-LISP, because they change some character definitions in the font, or something like FENAS, because it does some really strange things with the text editor screen and it removes the bottom line of the font (this looks bad with the original Enterprise system font as well).

I have created a new version of my font changes that keeps the original baseline of the EXOS font, at the cost of making the accents a lot less nice to look at on screen (but still more readable than the original font). This also has the small side benefit of saving 13 bytes of code space, and 10 bytes of font data.

Personally, I'd rather just patch and fix the few Enterprise programs that I want to use that don't like the lower baseline ... it makes that much of a difference to me!

Does anyone want to try the patched ROMs that use the original baseline?
Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.02. 16:55:18
Although there doesn't seem to be a lot of interest in this (judging from the lack of comments), assembly-language programmers might be interested in seeing the EXOS font decompression code, and my modifications to it, so here it is.
 
Title: Re: Changing the EXOS font
Post by: gflorez on 2020.December.02. 18:50:33
I didn't read your last comment, and I am interested.

Thanks.
Title: Re: Changing the EXOS font
Post by: dangerman on 2020.December.02. 21:44:26
Very cool. Some really nice looking tweaks to the font.

You talk about patching Zozo's rom in this thread. Did you know you can patch roms directly from sjasm using the INCBIN and CODE directives? I've successfully used this to make a custom EXOS 2.1 rom before.
Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.03. 00:11:36
I didn't read your last comment, and I am interested.

Here is the latest set of ROMs, with both "-hi" (better compatibility) and "-lo" (better accent) versions of the font.

There have been a number of small tweaks since I posted the last set of font files, and one notable change is that I have swapped the "£" and the "#" so that the "#" symbol is always available to UK users, which makes programming a lot nicer.

It has taken me a while to think of this, but I finally realised today that there is one solution that might give the best results (IMHO) for both UK and International users ...

That is to use the "-hi" font for its compatibility when in ":UK" keyboard mode, which is what you need to use anyway when running IS-FORTH or IS-LISP, and then use the "-lo" font with its better accents when in ":BRD"/":ESP"/":HUN" keyboard modes.

There is just enough free space in all of the language ROMs to patch in some code to do that transition.
Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.03. 00:23:20
Very cool. Some really nice looking tweaks to the font.

Thanks! :)


You talk about patching Zozo's rom in this thread. Did you know you can patch roms directly from sjasm using the INCBIN and CODE directives? I've successfully used this to make a custom EXOS 2.1 rom before.

I'm used to doing that on the PC Engine, and I had seen that sjasmplus (https://github.com/z00m128/sjasmplus) supports it, but I'm not using it yet because the fonts need to be processed before they are imported, and the EXOS ROM needs to have its checksum recalculated after the patching is done, so it was easier to write a quick C program to do the work.
Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.03. 16:14:02
It has taken me a while to think of this, but I finally realised today that there is one solution that might give the best results (IMHO) for both UK and International users ...

That is to use the "-hi" font for its compatibility when in ":UK" keyboard mode, which is what you need to use anyway when running IS-FORTH or IS-LISP, and then use the "-lo" font with its better accents when in ":BRD"/":ESP"/":HUN" keyboard modes.

Another advantage with changing the language ROMs in this way, is that the improved accents would be available to any Enterprise users (with EXOS 2.0 or 2.1) that wanted to burn a new language EPROM for their existing BASIC cartridge, and not just those people using a modified EXOS 2.4.
Title: Re: Changing the EXOS font
Post by: gflorez on 2020.December.03. 16:33:02
Yes, on a German Ep, the Language Rom is on the cartridge so, on some circumstances the internal font doesn't match the keyboard...
Title: Re: Changing the EXOS font
Post by: dangerman on 2020.December.03. 23:43:43
the fonts need to be processed before they are imported, and the EXOS ROM needs to have its checksum recalculated after the patching is done, so it was easier to write a quick C program to do the work.

Ah yes - the checksum!
Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.05. 17:28:38
It has taken me a while to think of this, but I finally realised today that there is one solution that might give the best results (IMHO) for both UK and International users ...

That is to use the "-hi" font for its compatibility when in ":UK" keyboard mode, which is what you need to use anyway when running IS-FORTH or IS-LISP, and then use the "-lo" font with its better accents when in ":BRD"/":ESP"/":HUN" keyboard modes.

This method is working really well, and doing things this way also solves the problem of BASIC (or other language) programs that reset the ROM font, and expect the original font baseline (the 7-pixel above / 2-pixel below positioning).

Moving the font down by one pixel when entering ":BRD"/":ESP"/":HUN" keyboard modes is easy, but then a number of characters in the font need to be fixed to take account of the lower baseline (or the updated look of the improved accents).

Here is what the patch code for the language ROMs looks like. It fits in less than 256 bytes, and there is plenty of space for that at the end of each of the language ROMs ...

; *****************************************************************************
; *****************************************************************************
; *****************************************************************************
;
; ENTERPRISE LANGUAGE ROM FIXUP
;
; Moves EXOS ROM font down by 1 line to make room for nicer accents.
;
; Patch language ROM at $DEEB (-$C000) to call "drop_font" instead of $DF4B.
;
; Assemble two files ...
;
; SPANISH=0
;
;   sjasmplus\sjasmplus exosdecode.s --lst --raw=language-patch-low.bin
;
; SPANISH=1
;
;   sjasmplus\sjasmplus exosdecode.s --lst --raw=language-patch-esp.bin
;
; *****************************************************************************
; *****************************************************************************
; *****************************************************************************


                if      1

SPANISH         =       0                       ; "!?" glyphs needed for Spanish.

                org     $FF00                   ; After moving hacker's name.

drop_font:      ld      a,(hl)                  ; Are we setting ":UK" mode?
                inc     a
                ret     z

                push    hl                      ; Incoming ISO-646 font address.

                ld      hl, .dummy_data         ; Find out the address of the
                call    $DF4B                   ; font in Nick RAM.

                ld      de, $047F               ; Move EXOS font down by
                add     hl, de                  ; one line.
                ex      de, hl
                ld      hl, $FF80
                add     hl, de
                ld      bc, $0400
                lddr

                ld      b, $80                  ; Clear top line of font.
                xor     a
.clear:         ld      (de), a
                dec     de
                djnz    .clear

                ld      hl, $0E + 1
                add     hl, de
                ld      (hl), $7E               ; Fix top line of cursor.
                ld      hl, $1F + 1
                add     hl, de
                ld      (hl), $FF               ; Fix top line of block.

                ld      hl, .fixup_data         ; Customize font to improve
                call    $DF4B                   ; accents and fix descenders.

                pop     hl                      ; Restore ISO-646 font address.
                jp      $DF4B

.fixup_data:    db      $02                     ; 'A'-umlaut
                ds      9
                db      $03                     ; 'O'-umlaut
                ds      9
                db      $04                     ; 'U'-umlaut
                ds      9
                db      $05                     ; 'A'-acute
                ds      9
                db      $08                     ; 'e'-acute
                ds      9
                db      $0A                     ; 'a'-grave
                ds      9
                db      $12                     ; 'a'-umlaut
                ds      9
                db      $13                     ; 'o'-umlaut
                ds      9
                db      $14                     ; 'u'-umlaut
                ds      9
                db      $15                     ; 'a'-acute
                ds      9
                db      $18                     ; 'e'-grave
                ds      9
                db      $67                     ; 'g'
                ds      9
                db      $6A                     ; 'j'
                ds      9
                db      $6E                     ; 'n' (to remove serif)
                ds      9
                db      $70                     ; 'p'
                ds      9
                db      $71                     ; 'q'
                ds      9
                db      $75                     ; 'u' (to add serif)
                ds      9
                db      $79                     ; 'y'
                ds      9

                if      SPANISH
                db      $21                     ; '!' (only for spanish)
                ds      9
                db      $3F                     ; '?' (only for spanish)
                ds      9
                endif

.dummy_data:    db      $FF

                endif

Title: Re: Changing the EXOS font
Post by: elmer on 2020.December.16. 22:14:16
Here is what I hope is the final version of the new font ROMs, unless somebody provides feedback requesting a change.

I have now also modified both EPDOS and TPT to contain new versions of HFONT, to match the changes in the new EXOS font, and I have included new versions of the EXDOS 1.4 ROMs that changes the embedded font checksums so that EXDOS recognizes the new fonts.

As for the font itself, there have been changes to the stop the "(C)" symbol from being chopped off in 80-column mode, the "r" character has been changed to make it fit the style of the rest of Enterprise font, and the "/\" characters have been made full height so that they look better to anyone that has been using a PC for the last 30 years.

Enjoy! :ds_icon_cheesygrin:

Title: Re: Changing the EXOS font
Post by: gflorez on 2020.December.16. 22:33:52
Great! You have worked a lot on it. I will test it, sure.

---

On the past, I remember there was an utility to load a different font on the EP, but it worked as a whole definition on a file.

Also, there was an utility with a bunch of fonts, that were swapped with a command.

The problem with such programs was that they ceased to work with the language Rom.