Adding VT100 Terminal support?

Post Reply
GinDiamond
New member
Posts: 5
Joined: Tue Sep 05, 2023 4:08 pm

Adding VT100 Terminal support?

Post by GinDiamond »

Hello,

I am a new z88dk user. I am trying to target the 8080 processor for my altairduino emulator, and it is connected to a terminal via the vt100 terminal, onboard and external.

gotoxy and things from conio.h do not seem to work at all. From what I understand, conio.h works on VT52 and VT100 terminals, by communicating to the hardware directy...if that means direct in/out() on ports, I don't know. Also, conio.h seems to work via bdos calls, however only for the adm-3a terminal if you use the flag --generic-console.

My question is, do I have to write code to change the bdos calls to vt100 standards, or, can I change ports or the like for conio.h to work with vt52/100 without having to write new code?
User avatar
dom
Well known member
Posts: 2011
Joined: Sun Jul 15, 2007 10:01 pm

Re: Adding VT100 Terminal support?

Post by dom »

This topic came up earlier this year, but with VT52 on the PCW.

Unless you need to peek the screen there's no need to write a driver - just define some equivalent macros, eg:

Code: Select all

#define gotoxy(x,y) cprintf("\x1b[%d;%df",y,x);
When you have a set I'm happy to add them into conio.h in a way that they can be accessed easily.

If you do need to peek the screen, then unfortunately a driver would be needed - it looks like I wrote/started on a vt52 equivalent earlier this year: https://github.com/z88dk/z88dk/blob/mas ... e_vt52.asm which is probably a good starting point.
GinDiamond
New member
Posts: 5
Joined: Tue Sep 05, 2023 4:08 pm

Re: Adding VT100 Terminal support?

Post by GinDiamond »

Oh my gosh, thank you so much! This is the perfect jumping off point.
I'll pop the macros in for now, but I'll definitely take a look at that asm!
GinDiamond
New member
Posts: 5
Joined: Tue Sep 05, 2023 4:08 pm

Re: Adding VT100 Terminal support?

Post by GinDiamond »

So, I think I got some codes ready to go
However, I'm a little unclear on the textcolor textbackground. I see that in conio.h that it is wrapped in vtrendition(), does that mean it will work with the vt100 DMACRO switch and I don't need to worry about porting those?

textattr, clrscr, and gotoxy:

Code: Select all

#define	textattr(a)		cprintf("\x1b[%dm",a)
#define	clrscr()		cprintf("\x1b[2J")

#define	gotoxy(a,b)		cprintf("\x1b[%d;%df",y,x)
As far as I can tell, reading using getch and such works fine, I'll let you know if I come across problems.
User avatar
dom
Well known member
Posts: 2011
Joined: Sun Jul 15, 2007 10:01 pm

Re: Adding VT100 Terminal support?

Post by dom »

I've gone back in time and it looks like we used to have:

Code: Select all

#define textcolor(a)	printf("\033[%um",PCDOS_COLORS[a]+30)
#define textbackground(a)	printf("\033[%um",PCDOS_COLORS[a]+40)
#define textattr(a)	printf("\033[%um\033[%um",PCDOS_COLORS[a&0xF]+30,PCDOS_COLORS[a>>4]+40)
#define highvideo()	printf("\033[1m")
#define lowvideo()	printf("\033[2m")
#define normvideo()	printf("\033[m")
Though I'm sceptical about the use of PCDOS_COLORS - that might be a mapping from win32 colours to vt100 colours.
GinDiamond
New member
Posts: 5
Joined: Tue Sep 05, 2023 4:08 pm

Re: Adding VT100 Terminal support?

Post by GinDiamond »

I did see the pcdos colors thing, I'd bet money that pcdos colors and vt100 commands are one and the same.
I guess way more people use adm3a terminals than I thought, I thought everyone uses vt100 now XD
User avatar
dom
Well known member
Posts: 2011
Joined: Sun Jul 15, 2007 10:01 pm

Re: Adding VT100 Terminal support?

Post by dom »

Most CP/M software is written for a an adm3a console. There's a few we've run across which support vt52 as well.

In terms of code size, the code to handle adm3a or vt52 to disable on a CRT is a lot smaller than a vt100 engine so going that route maximises TPA.
User avatar
dom
Well known member
Posts: 2011
Joined: Sun Jul 15, 2007 10:01 pm

Re: Adding VT100 Terminal support?

Post by dom »

I've pushed something that seems to make ansitest.c broadly work: compile with -DCONIO_NATIVE_VT100 - let me know how you get on.
GinDiamond
New member
Posts: 5
Joined: Tue Sep 05, 2023 4:08 pm

Re: Adding VT100 Terminal support?

Post by GinDiamond »

I'll test it out later today, I'll let you know!
Post Reply