PLATOTERM - solving the screen redraw problem, need input.

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Fri Jun 07, 2019 4:17 pm

Hey guys,

This is now my seventh rewrite of PLATOTERM for Atari ST.

PLATOTERM is a terminal program. It does not simply render text, it does not scroll. It draws data as it comes in, and everything that PLATO does expects this instant draw, particularly with animation.

The problem here, is that terminal control protocols are HIGHLY STATE DEPENDENT. The usual model of just reconstructing the document from what's in memory becomes very unwieldy, because you essentially run into having to do it one of three ways:

(1) keep a copy of the received data, replay the entire buffer when asked to redraw, reset buffer pointers back to 0 when screen clears.

This works, and can even be made to work somewhat well, but it falls short when you have long running screens that update data (such as dashboards), because you eventually fill up your buffer, or your buffer runs out of room to grow. And as the amount of data that gets drawn on one screen increases, so does the time required to bring the display back up to date when asked to redraw. Also, you can't separate the protocol data to isolate parts that need redrawing, because of the highly state dependent nature of the protocol.

(2) decode the data, place in a list, replace drawing operations that have same drawing operation and coordinates

This can be made to work, as well. but the overhead of maintaining the list, and constantly traversing it to find replaceable items becomes exponentially slower as the whole thing increases. Whole program slows to a crawl. Can't find a hash table algorithm that would help me here.

(3) create an off-screen color (or mono) bitmap; routines to draw into bitmap, blit rects onto VDI surface as directed by AES.

This would ideally be the right move to make, IF IT WERE ACTUALLY POSSIBLE IN A COMPATIBLE MANNER!

But GEM as shipped via TOS has no facility to create an off-screen bitmap, nor does VDI have any way to draw to an off-screen bitmap. This is perhaps one of the most maddening aspects about GEM programming documentation, I find a function that would ultimately solve all of my problems:

http://toshyp.atari.org/en/00700a.html

but only works if NVDI is provided, which is a no-go for this program, as it needs to work on as many systems as possible.

I am at a loss here, what the hell can I do?

What I can not do, so don't even bring it up:

* Use GODLIB. This is not a game. It's a productivity app. GODLIB does not solve many of the problems that this terminal program needs to function.

* Bypass the OS - Again, THIS IS NOT A GAME. It actually has a couple of dialogs to handle preferences, as well as display informative secondary windows.

-Thom

czietz
Hardware Guru
Hardware Guru
Posts: 987
Joined: Tue May 24, 2016 6:47 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby czietz » Fri Jun 07, 2019 4:36 pm

Off-screen bitmaps are also added to VDI by Enhancer, a freeware program of the NVDI authors: see attachment. I'm aware that this isn't the perfect solution you were perhaps looking for, either. But being freeware, you can redistribute it with PLATOTERM.
You do not have the required permissions to view the files attached to this post.

mikro
Hardware Guru
Hardware Guru
Posts: 2015
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby mikro » Fri Jun 07, 2019 6:02 pm

tschak909 wrote:but only works if NVDI is provided, which is a no-go for this program, as it needs to work on as many systems as possible.

I am at a loss here, what the hell can I do?

I wouldn't be so strict on yourself here. Virtually every Atari user uses NVDI, it has many benefits for basic OS usage.

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Fri Jun 07, 2019 6:22 pm

Every time I put NVDI on a machine with 1MB of RAM, I run out of RAM, so this is a no-go for me.

-Thom

robdaemon
Atariator
Atariator
Posts: 26
Joined: Mon Jul 24, 2017 5:01 am

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby robdaemon » Fri Jun 07, 2019 6:36 pm

mikro wrote:I wouldn't be so strict on yourself here. Virtually every Atari user uses NVDI, it has many benefits for basic OS usage.


I don't use it on most of my machines because of how much RAM it takes. NVDI is wonderful, but on my Mega 2 machine, I can't sacrifice the RAM.

joska
Hardware Guru
Hardware Guru
Posts: 4381
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby joska » Fri Jun 07, 2019 8:50 pm

I'd stick with offscreen bitmaps, it makes things a lot easier in this case. Not many people will use GEM applications without NVDI these days, and if they do there's always Enhancer which does not use much RAM.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

vido
Atari Super Hero
Atari Super Hero
Posts: 693
Joined: Mon Jan 31, 2011 7:39 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby vido » Sat Jun 08, 2019 6:38 am

I also believe almost 100% of people who use GEM software is also using NVDI.

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1699
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby Cyprian » Sat Jun 08, 2019 7:21 am

vido, on TT/Falcon probably yes, on ST I'm not sure
Lynx II / Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

vido
Atari Super Hero
Atari Super Hero
Posts: 693
Joined: Mon Jan 31, 2011 7:39 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby vido » Sat Jun 08, 2019 9:55 am

Cyprian wrote:vido, on TT/Falcon probably yes, on ST I'm not sure

I am using only clones (Milan, FireBee) and on that computers are usable mostly only GEM software. On "powerful" Ataris are mostly users using "productive" software while on ST computers with less that 4MB of RAM are by my opinion mostly gamers and coders trying to get out most of the low spec computers. I dont think they are that much interested into Platoterm. But I could be wrong. Just my opinion.

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5101
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby simonsunnyboy » Sat Jun 08, 2019 12:25 pm

vido wrote:
Cyprian wrote:vido, on TT/Falcon probably yes, on ST I'm not sure

I am using only clones (Milan, FireBee) and on that computers are usable mostly only GEM software. On "powerful" Ataris are mostly users using "productive" software while on ST computers with less that 4MB of RAM are by my opinion mostly gamers and coders trying to get out most of the low spec computers. I dont think they are that much interested into Platoterm. But I could be wrong. Just my opinion.


We are interested in Platoterm aswell but don't need a GEM application. A fullscreen customtailored version would do nicely for us.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

jd
Captain Atari
Captain Atari
Posts: 355
Joined: Thu Nov 09, 2006 12:38 pm
Location: Ruislip, UK

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby jd » Sat Jun 08, 2019 1:55 pm

I know i'm a stuck record on this but Sting support for Platoterm please :)

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12722
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby wongck » Sat Jun 08, 2019 4:19 pm

Hard to believe Plato being a 70s application cannot be implemented on an ST that's with a decade of advancement.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Sat Jun 08, 2019 4:28 pm

For now, I am keeping a protocol replay buffer, which gets length-zeroed on screen clear. With a little bit of additional logic, it works.

Looks like I will also need to check for top window and only do direct rendering if the window is on top, to prevent corruption of other windows.

-Thom

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1699
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby Cyprian » Sat Jun 08, 2019 6:46 pm

wongck wrote:Hard to believe Plato being a 70s application cannot be implemented on an ST that's with a decade of advancement.

soo true
Lynx II / Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Sat Jun 08, 2019 7:45 pm

really appreciate the sarcasm.

-Thom

User avatar
christos
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2448
Joined: Tue Apr 13, 2004 8:24 pm
Location: Greece
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby christos » Sat Jun 08, 2019 8:33 pm

Cyprian wrote:
wongck wrote:Hard to believe Plato being a 70s application cannot be implemented on an ST that's with a decade of advancement.

soo true


Why? The way i understand it is that it's basically an emulator that has to run in a GEM window at a certain speed.
I think that ignoring GEM is a better option though. After all plato was built before GUIs
Felix qui potuit rerum cognoscere causas.
My Atari blog

STOT Email address: stot(NoSPAM)atari(DOT)org

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Sun Jun 09, 2019 12:35 am

I've got it mostly working by implementing a replay of the terminal buffer, zeroing out the received buffer on screen clear (if it isn't being redrawn)
There are some glitches I have to work out (on some displays, the currently selected font memory is incorrect, causing garbage on redraw).

I know this seems a bit strange, but the PLATO terminal protocol itself is very complex, see:
https://irata.online/assets/s0ascers-04 ... 20ad1.html

and it was an incredible accomplishment to be able to render this into a very portable manner.

As it stands right now, PLATOTERM will even run on 520ST's with TOS 1.0 (this was made possible by using libcmini, as the mintlib was chomping up way too much program space! I do not need MINT functionality at all.)

But with this, I can now fold in the required dialogs (settings, PLATO key chart, and phone book), and spend however long debugging it all.

It's critical for me that this program works on as many ST/TT/GEM systems as possible, so literally using nothing but VDI/AES is the only option for me.

(as for the refill buffer, I've aligned it so that it will simply clear itself when it gets full)

-Thom

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12722
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby wongck » Sun Jun 09, 2019 1:58 am

tschak909 wrote:But GEM as shipped via TOS has no facility to create an off-screen bitmap, nor does VDI have any way to draw to an off-screen bitmap. This is perhaps one of the most maddening aspects about GEM programming documentation, I find a function that would ultimately solve all of my problems:

http://toshyp.atari.org/en/00700a.html

but only works if NVDI is provided, which is a no-go for this program, as it needs to work on as many systems as possible.


From what i know, those functions refereed by the URL you posted are mostly available in TOS.
NVDI specific functions are clearly marked and even stated with versions when they are available.
Best that your program also checks for validity of AES version, to be on the safe side.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12722
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby wongck » Sun Jun 09, 2019 1:59 am

wow. This program works for so many different systems. That’s great
Last edited by wongck on Sun Jun 09, 2019 8:48 am, edited 1 time in total.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12722
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby wongck » Sun Jun 09, 2019 2:10 am

tschak909 wrote:It's critical for me that this program works on as many ST/TT/GEM systems as possible, so literally using nothing but VDI/AES is the only option for me.

(as for the refill buffer, I've aligned it so that it will simply clear itself when it gets full)


From what I know, ST/TT/Falcon all have a ST screen mode compatibility so it will work as long as it uses simple TOS calls and ST screen.
The Hirez screen mode may be limited due to ST needing specific monitor ( but then again nowadays most ppl will have a cable for their LCD that works).

As for the buffer with limited memory.... you can implement a ring buffer. May or may not work for your system. I believe most serial comms buffer are these anyway.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2501
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby charles » Sun Jun 09, 2019 12:10 pm

is it reasonable to suggest that some data should be written to disk in some type of ".DAT" file to save precious memory?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
Kirkman
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 145
Joined: Fri Sep 03, 2010 2:29 am

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby Kirkman » Mon Jun 10, 2019 3:04 pm

Virtually every Atari user uses NVDI, it has many benefits for basic OS usage.

nowadays most ppl will have a cable for their LCD that works


Just want to put it out there that _not_ all Atari users use these things. I don't have NVDI. And I don't have an LCD, only an original SC1224 monitor.

One of the awesomest things about PlatoTerm is how widely it supports the various platforms. I appreciate schak909's efforts to make it run everywhere.

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1699
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby Cyprian » Mon Jun 10, 2019 5:06 pm

One solution is to add Enchancer to Platoterm package and use all offscreen functionalities like v_open_bm / v_opnbm

Or there is an other solution for non-preemptive TOS (1/2/3/4) - "_v_bas_ad". GEM uses that vector for painting the screen.

Set "_v_bas_ad" pointer to your off-screen address (your buffer with 32000 bytes) before painting offscreen and restore "_v_bas_ad" after finishing painting.

TOS and other applications (only accessories in case of non-preemptive TOS) will wait with its painting process for releasing the CPU with event-multi by your application.
Lynx II / Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 749
Joined: Sun Aug 03, 2014 5:54 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby ThorstenOtto » Tue Jun 11, 2019 1:39 am

Cyprian wrote:Set "_v_bas_ad" pointer to your off-screen address (your buffer with 32000 bytes) before painting offscreen and restore "_v_bas_ad" after finishing painting.


I also already thought about to give that advice, but it has one drawback: it will not work with NVDI, when using a graphics card. It will also fail on most non-standard setup (like emulators).

I think the easiest thing is to test for availability of v_opnbm() function (via EdDI cookie), and if that is not available, tell the user to install that enhancer.prg. It is very short and won't consume much memory.

tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: PLATOTERM - solving the screen redraw problem, need input.

Postby tschak909 » Tue Jun 11, 2019 1:43 am

as I said, I've managed to come up with a redraw method that I can improve upon.

I will not require anyone to install VDI enhancers, that's a hard "no."

-Thom


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 1 guest