Enterprise Forever

:UK => Programming => Topic started by: elmer on 2020.November.29. 18:48:09

Title: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.November.29. 18:48:09
The Enterprise's 40-column text video driver only allows two colour palette choices (0,1) or (2,3).

The Enterprise's 80-columm text video driver allows four colour palette choices (0,1), (2,3), (4,5), (6,7) ... but does so by enabling the Nick video setting that clips off the right hand side of text characters.

This works, but it looks really ugly, and from my personal point of view, it makes the Enterprise look really bad in comparison to the Amstrad CPC and the BBC Micro! :(

From what I can see, programs like EPDOS, HEASS, FENAS, etc implement their own 80-column text ouput routines so that they can avoid this and use the full 7-pixel width, even though that limits them to two colour palettes, the same as 40-column text.

Does anyone know of any Enterprise programs that use the 3rd or 4th colour palettes in 80-column text mode?

Can anyone think of a reason why I should not just patch EXOS to use the full 7-pixel width and limit 80-column text to two palettes?

From what I can see, all of the Intelligent Software languages only use two palettes anyway, because they need to work in both 40-column and 80-column text modes!
Title: Re: 80-column text and clipping the right hand side of characters
Post by: geco on 2020.November.29. 21:34:38
i do not know about program, which uses 80 column "text" mode, i think 2 color is neede mainly for the cursor.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: Zozosoft on 2020.November.29. 21:48:03
For example my FDISK... (http://ep128.hu/Ep_Util/FDISK.htm)
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.November.29. 22:02:43
I have tried to use more than 2 colours on text 80 mode, but it has an annoying tendency to jump lines when there is CR or at the end of line. On the middle of the screen the alternate colours work great.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.November.30. 21:03:55
For example my FDISK... (http://ep128.hu/Ep_Util/FDISK.htm)

Thanks!

FDISK is a really nice program to demonstrate the use of the 4 palettes, but IMHO it wouldn't lose any important information by being limited to 2 palettes.

It will make an excellent test to verify that patching EXOS doesn't actually break anything!


i do not know about program, which uses 80 column "text" mode, i think 2 color is neede mainly for the cursor.

I can see the 2nd set of colours used for menu letters in HiSoft Pascal and in some CP/M programs, also in ASMON, but I didn't see any use of more than 2 palettes on a line until Zozo's FDISK.


I have tried to use more than 2 colours on text 80 mode, but it has an annoying tendency to jump lines when there is CR or at the end of line. On the middle of the screen the alternate colours work great.

That is good to know!

From what I can see, there won't be any programs that are made difficult to use by limiting 80-column text to 2 palettes.

As you may have guessed from my EXOS font changes ... I *really* care about making text readable and pleasant to look at, because as a programmer, I spend most of my day looking at screens full of text.

I have used my own customized font on the PC from the early days of MS-DOS, all the way up to current versions of Windows.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.01. 11:18:40
Then, what you want to do is modify the VIDEO: driver...?



And surgically on the EXOS Rom, like you did with the font....?




I suggest you another way that will be easier and with less handicaps: better modify the Interlace VIDEO: driver.

For some good reasons it will be the west way:

-You will learn how the relocatable code loads on the Enterprise. You always can convert the driver to fixed address for better developing.
-You will learn how an extension loads itself and installs. The same with a driver.
-Maybe you could fix some issues the Interlace mode has, to make it more usable....
-Etc...

Once you have a working driver you can proceed to modify/paste it inside the Rom.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.02. 16:07:36
I am taking a look to the Interlace file, and it doesn't loads as an extension, but as an user relocatable module(02 type-file)....

So probably I am totally wrong and there is not a VIDEO: driver inside...

Interlace is not new at all, so the content of the file is known since long time.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: Zozosoft on 2020.December.02. 16:55:37
So probably I am totally wrong and there is not a VIDEO: driver inside...
No, you are right, it is add a new VIDEO: driver!
[attach=1]
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.02. 17:51:21
Ah, great!

So now I am going to decode the relocatable file... with a Basic program.

I did the same long time ago, to study the Mordon Quest game.

Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.02. 20:57:09
Then, what you want to do is modify the VIDEO: driver...?

Yes, that is the idea.

I have already found out where to patch both EXOS and IS-DOS, but I'm not happy with my EXOS patch yet, because there are a couple of unwanted side-effects that are showing up.


I suggest you another way that will be easier and with less handicaps: better modify the Interlace VIDEO: driver.

Creating a modified VIDEO driver would definitely be the cleanest way to make any changes, and it could also be used to inject my new font into the system without patching EXOS.

But doing that would really not make much sense unless there was already well commented source code available for the EXOS VIDEO driver.

Even then, it would make the most sense (IMHO) to include the driver inside modified version of the language ROMs, and I'm not sure if the source code for those ROMs is available, or if there is enough spare space within each ROM.

Seriously, since I am really only trying to fix my own personal dissatisfaction with the font rendering code, it is probably just easier for me to patch the programs that I need to.

As it is, with the changes in the new font, I suspect that I will be happy with just patching IS-DOS, and leaving the EXOS VIDEO driver alone so that it doesn't change the look of Zozo's FDISK, or ASMON's help screen (since I have now found that ASMON also uses more than 2-palettes in 80 column text mode).
Title: Re: 80-column text and clipping the right hand side of characters
Post by: dangerman on 2020.December.02. 21:54:56
I am taking a look to the Interlace file, and it doesn't loads as an extension, but as an user relocatable module(02 type-file)....

So probably I am totally wrong and there is not a VIDEO: driver inside...

As Zozosoft says, it does contain a new video driver. Because it's a user module and not an extension, the new driver doesn't remain when you leave Basic. It probably wouldn't be too hard to make an extension out of the existing code. I guess they didn't do this originally because it would take away one 16k segment and that would be a problem for the EP64. The interlaced screen already takes up most of the memory.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: dangerman on 2020.December.02. 21:57:16
I have already found out where to patch both EXOS and IS-DOS, but I'm not happy with my EXOS patch yet, because there are a couple of unwanted side-effects that are showing up.

Wow - I'd be very interested in seeing these patches once you've got them working.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.02. 22:20:48
Okay no problem. As long as your "dissatisfaction" with the Enterprise doesn't grow excessively...

-----------------

I have been always curious with the bad behaviour of the Interlace driver, so I will continue reporting what I found.

I have made a basic listing to decode such relocatable files. It only shows a list of commands and its parameters as a row of bits, later it could be modified easily to save the data on other format, Hex or Raw.

If some of you want to see, for example, the entire 5KB of the Interlace.COM file, better put the emulator to max speed.

The interlaced screen already takes up most of the memory.

Great! I like to take the EP up to its limits.....
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.03. 11:57:40
As Zozosoft says, it does contain a new video driver. Because it's a user module and not an extension, the new driver doesn't remain when you leave Basic. It probably wouldn't be too hard to make an extension out of the existing code. I guess they didn't do this originally because it would take away one 16k segment and that would be a problem for the EP64. The interlaced screen already takes up most of the memory.

You are right, the new VIDEO: driver is forced to install on the Basic area so, once the user exits from Basic the system is corrupted and forced to reset. That is annoying, but maybe they done that way because probably the Interlace driver works badly outside the Basic interpreter.

I have always read that an EP64 cant load the Interlace driver. At least on the emulator it crash.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: dangerman on 2020.December.03. 23:34:57
I have always read that an EP64 cant load the Interlace driver. At least on the emulator it crash.

I had an original EP64 and the interlace driver was supplied with it on the demo cassette. It worked!

but maybe they done that way because probably the Interlace driver works badly outside the Basic interpreter.

Yes, I imagine most software would need to be modified to work in interlace mode. It may also be a problem that it only supports Text 80 and HIRES graphics modes.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.16. 22:31:51
Wow - I'd be very interested in seeing these patches once you've got them working.

Do you (or anyone else) want to try a patched version of IS-DOS, with a modified version of the IS-DOS fast video driver that uses the 7-pixel/2-palette Nick setting for the 80-column text.

It also includes modifications to speed up the core font drawing by 3x, erase-line by 4x, and erase-to-end-of-line by 6x ... unfortunately the overhead in the IS-DOS code is so large that this only speeds up the IS-DOS VT52 emulation by about 25% in my tests, but any speed improvement is welcome IMHO.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.17. 00:35:37
Off-topic:

Some time ago I was interested on adding mouse control to the EDITOR device on text mode, much the same as was done on MS-DOS on PCs, on character boundaries.

The stock Boxsoft mouse driver only allowed a pointer on graphics modes, but with my few skills on assembler I managed (https://enterpriseforever.com/programming/universal-mouse-driver/) to add the two text modes(40/80) on user screens.

The idea was to manage also an Editor screen, but I was not able to do EXOS calls within an interrupt, to move the text cursor to the mouse pointer position when a click being done (https://enterpriseforever.com/programming/universal-mouse-driver/?action=dlattach;attach=16615).

The most promising solution was to modify the Editor driver that comes on the language Rom, but such option was very difficult for me to try....

---

It seems that you are comfortable modifying Roms, so may be you could be interested on such project. The good point on adding a mouse to the Editor control is that almost all Enterprise text-programs use it, so the integration could be total.

----

Also a mouse driver in Rom would be a great advance, because by now it is a loadable extension.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: geco on 2020.December.17. 08:33:20
I would like to test it, "text 80" mode is slow, and any speed up is welcome :)
Title: Re: 80-column text and clipping the right hand side of characters
Post by: dangerman on 2020.December.17. 20:55:17
Do you (or anyone else) want to try a patched version of IS-DOS, with a modified version of the IS-DOS fast video driver that uses the 7-pixel/2-palette Nick setting for the 80-column text.

Sounds great. Back in the day, I used to use WordStar under IS-DOS so maybe I could dust that off.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.19. 04:51:08
Sounds great. Back in the day, I used to use WordStar under IS-DOS so maybe I could dust that off.

Yes, it's all a case of "Back In The Day" for me, too! :lol:

The first text editor that I used at a professional programming job was VEDIT (https://en.wikipedia.org/wiki/VEDIT) for CP/M, way back in 1982.

The same original author still develops VEDIT for Windows (https://www.vedit.com/), and makes sure that it keeps on working, even though there are not many active users still around.

It remains one of the most powerful text editors that I have ever used, especially after BRIEF and MultiEdit both stopped being updated, and became unusable on modern systems.


I would like to test it, "text 80" mode is slow, and any speed up is welcome :)

Yes, I agree! :cool:
Title: Re: 80-column text and clipping the right hand side of characters
Post by: BruceTanner on 2020.December.19. 10:33:20
The first text editor that I used at a professional programming job was VEDIT (https://en.wikipedia.org/wiki/VEDIT) for CP/M, way back in 1982.
All of EXOS, IS-BASIC, and EXDOS were written using vedit(plus)! (Using the new MS-DOS 1 initially). :mrgreen:
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.19. 21:38:41
All of EXOS, IS-BASIC, and EXDOS were written using vedit(plus)! (Using the new MS-DOS 1 initially). :mrgreen:

Haha, cool! :mrgreen:

I *thought* that I remembered using VEDIT when I worked my summer in the IS basement, but I wasn't sure enough to claim it out loud.

I used the CP/M version before that in my job before University, writing educational software at a small company in Birmingham.  I think that they're the ones that I pirated a CP/M copy from, all those years ago, but it could easily have been IS.  I certainly couldn't afford to buy my own back then! ;-)

I was using VEDIT under IS-DOS for my Enterprise port of Cauldron, and then for my first two Amstrad games when at Ocean.


BTW ... do you know if anyone has the source code for IS-DOS?  There are a couple of speedups that I can think of that would really require rebuilding it from source, rather than just hacking the binary.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: BruceTanner on 2020.December.19. 21:57:02
BTW ... do you know if anyone has the source code for IS-DOS?  There are a couple of speedups that I can think of that would really require rebuilding it from source, rather than just hacking the binary.
Zozo got some source files from Verner but not in a usable form at the moment... work in progress! The trouble is all the source files from EXOS, IS-BASIC, EXDOS, IS-DOS and utilities are all mixed up on various floppies. It's as if someond did a backup of everything onto floppies but got the floppies mixed up during the backup process.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.20. 20:15:39
The trouble is all the source files from EXOS, IS-BASIC, EXDOS, IS-DOS and utilities are all mixed up on various floppies. It's as if someond did a backup of everything onto floppies but got the floppies mixed up during the backup process.

Yuk, that sounds like a horrible mess to go through! :(

I suspect that there could be enough unique code/text sequences in IS-DOS that a regex search could be run to identify some of the IS-DOS source files ... but I could also easily be wrong about that.

As it is, it looks like there is still $90 bytes of unused space in the IS-DOS BDOS/BIOS section of the program that can be used for extra code, and I'll give that a try.

There is also the possibility of just overwriting the code for the regular IS-DOS VT52 video output that uses EXOS channels, and making the "FAST" video be the only option for CP/M programs.  I'd prefer to avoid doing that, but it is certainly a possibility.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.20. 22:16:41
The most promising solution was to modify the Editor driver that comes on the language Rom, but such option was very difficult for me to try....

That makes the most sense to me, because if I understand you, then what you want to do is really best handled at a low level, i.e. inside the "EDITOR:" driver.


It seems that you are comfortable modifying Roms, so may be you could be interested on such project. The good point on adding a mouse to the Editor control is that almost all Enterprise text-programs use it, so the integration could be total.

I'm sorry, but I think that what you are proposing is probably going to be too big a modification to handle by simple hacking. You would really want to build that capability into a new "EDITOR:" driver that you make entirely from source code.

As it is, the only reason that I can make such deep changes to IS-DOS, is because I could find some unused memory inside the program itself ... which is not unusual given the tools that we all had available in the 1980s.  ROMs were usually built with more care to use every byte available, because wasted space meant wasted money (i.e. a larger ROM chip).


Also a mouse driver in Rom would be a great advance, because by now it is a loadable extension.

I am afraid to say that I generally prefer the idea of extensions rather than ROMs, because it is easier to update an extension file than to burn a new ROM, and also because you can use self-modifying code in RAM extensions (for speed). ;-)
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.20. 23:57:26
I think that it is not necessary to modify the Editor, only to include the click management on the Editor loop.

The Editor driver on the language Rom is a copy of the original one on the EXOS Rom, and I discovered(or was Bruce Tanner?) (https://enterpriseforever.com/programming/universal-mouse-driver/msg64553/#msg64553) on the Hungarian disassembly the point where the loop is started again.

The idea I had was to make a branch to the free space at the end of the Rom and then check if the mouse driver is active on the Editor screen(only checking a System variable). If yes, execute the events scheduled on the mouse driver, printing legal codes on the Editor channel. The easiest of all events is to move the text cursor to the mouse pointer position with the Esc=<y><x> sequence, or a double click can execute a Carriage Return on the pointer position, that the Basic would interpret as Enter.

Once the events executed, the control is returned to the Editor loop.

Writing to the Editor channel is the only way to not corrupt its pointers and still be compatible.

--------

Ok, this mouse thing is only my desire, and I can understand that it is not important for other users.

Thanks for giving me your opinion.

Title: Re: 80-column text and clipping the right hand side of characters
Post by: dangerman on 2020.December.22. 21:14:57
This is exciting stuff. Hopefully over Christmas I'll find some time to check the ISDOS patch out (family permitting!)

And regarding the mouse - I think calling the mouse driver from a modified EDITOR driver would be a really nice idea. It expect it would be hard to do this in a system-friendly way without a modified EDITOR device. That's just what the EDITOR is for - it's a higher level interface to the keyboard and video devices and could also handle the mouse device.

Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.23. 12:04:40
The first text editor that I used at a professional programming job was VEDIT (https://en.wikipedia.org/wiki/VEDIT) for CP/M, way back in 1982.

It works on IS-DOS!  I have selected VT52 as the terminal driver, and redefined some keys.

It allows the edition of very big files without memory paging, taking chunks of the file from disk, but I have still not tried this option.

I have downloaded it from here (http://www.classiccmp.org/cpmarchives/cpm/mirrors/www.retroarchive.org/cpm/text/text.htm). At the end of the page there are two zips with files v2.33b. Create a disk image, or format a disk, and throw all files inside it.

On IS-DOS, execute:  INSTALL VPLUSZC.SET VEDIT.COM

First, you will need to configure the program.

Title: Re: 80-column text and clipping the right hand side of characters
Post by: BruceTanner on 2020.December.23. 13:54:08
Good find gflorez! :ds_icon_cheesygrin:
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.23. 18:21:11
It works on IS-DOS!  I have selected VT52 as the terminal driver, and redefined some keys.

Yes, I know ... as I said a few messages ago, I used it on IS-DOS in the 1980's to write 3 games!

I also posted my copy of VEDIT v2.31, customized for the Enterprise, here (https://enterpriseforever.com/hall-of-fame/en-vagyok-a-hibas-im-to-blame/msg78343/#msg78343) earlier this year. ;-)


It allows the edition of very big files without memory paging, taking chunks of the file from disk, but I have still not tried this option.

It does this automatically when it needs to, you don't need to set any specific options (except to install it properly).


I have downloaded it from here (http://www.classiccmp.org/cpmarchives/cpm/mirrors/www.retroarchive.org/cpm/text/text.htm).

Yes, IIRC that's where I downloaded a copy of v2.33 many years ago, when Ted Green released it as freeware back in 2008.

I still haven't set it up for the Enterprise, yet, but I'll have to do so soon.


On IS-DOS, execute:  INSTALL VPLUSZC.SET VEDIT.COM

First, you will need to configure the program.

That works, but you really need to do a bit more than that if you want to customize it to take full advantage of the Enterprise's capabilities.

Personally, I created a custom terminal (because VEDIT's VT52 doesn't use reverse-video, i.e. using a 2nd palette), and then I hacked VEDIT v2.31 to support using the Enterprise's function keys and to automatically select IS-DOS's fast video driver.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: gflorez on 2020.December.23. 18:31:12
You can't stay quiet...

Thanks.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: BruceTanner on 2020.December.23. 19:27:09
I also posted my copy of VEDIT v2.31, customized for the Enterprise, here (https://enterpriseforever.com/hall-of-fame/en-vagyok-a-hibas-im-to-blame/msg78343/#msg78343) earlier this year. ;-)
Sorry, I missed that bit :oops: probably caught me while I was distracted with something else! :oops:
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2020.December.23. 20:08:26
Sorry, I missed that bit :oops: probably caught me while I was distracted with something else! :oops:

Hahaha ... I'm fairly amazed that *anyone* bothered to look at those boring old disk images! :lol:


I can't even remember anymore what VEDIT functions I assigned to the Enterprise's function keys, so I suspect that installing a new version would be a good idea for anyone that actually wanted to use VEDIT on IS-DOS in modern times.

Creating a new VEDIT terminal definition to support the Enterprise's reverse-video (i.e. palette 2) is easy using VEDIT's own "INTMOD.COM" tool that is on the 2nd disk that gflorez found.


Modifying VEDIT itself is also easy because, as a CP/M program, you can just add an extra disc-sector's worth of code onto the end of the VEDIT program file after you customize it to your own taste, and then save out the larger file, and everything will work.

In my case, I patched the VEDIT starting code at $100 (when it is loaded), and changed it to jump to new new patch that I added at the end of the program.

FWIW, I did basically the same thing to the version of Wordstar that is on that Cauldron IS-DOS system disc.


Anyway, this is the patch, it is really very simple  ...

; Hack VEDIT v2.31 to select the IS-DOS fast video driver, and to define
; the Enterprise's 10 function keys to return keyboard codes $F0-$FF.

.   5A00  21 C9 05     LD    HL, $05C9          ; Original jump location from VEDIT 2.31
.   5A03  22 01 01     LD    ($0101), HL

.   5A06  0E 85        LD    C, $85             ; "Select Fast Video Driver"
.   5A08  CD 05 00     CALL  5                  ; CP/M BDOS call

.   5A0B  06 08        LD    B, 8               ; Subfunction 8, "Define Function Key"
.   5A0D  3A 27 5A     LD    A, ($5A27)         ; Which function key (0..15)?
.   5A10  E6 0F        AND   $0F
.   5A12  4F           LD    C, A
.   5A13  11 26 5A     LD    DE, $5A26          ; Ptr to function key string
.   5A16  3E FE        LD    A, $FE             ; Channel # for keyboard
.   5A18  F7 0B        EXOS  $0B

.   5A1A  3A 27 5A     LD    A, ($5A27)         ; Increment function key #
.   5A1D  3C           INC   A
.   5A1E  32 27 5A     LD    ($5A27), A
.   5A21  20 E8        JR    NZ, $5A0B

.   5A23  C3 00 01     JP    $0100              ; Return to VEDIT.

.   5A26  01           DB    $01                ; Function key string length.
.   5A27  F0           DB    $F0                ; Function key string character.
Title: Re: 80-column text and clipping the right hand side of characters
Post by: elmer on 2021.January.10. 19:48:41
Following up on VEDIT ... I have found my archive of the original VEDIT 2.31b Master Disc, complete with the modified terminal files for both the Enterprise and Amstrad CPC, and the original source code to my patch.

What is also interesting about this distribution of VEDIT, is that there is a lot of useful extra documentation about how to customize the program, that isn't included in the Ted Green's public release of VEDIT 2.33b.

Enjoy! :ds_icon_cheesygrin: