Porting PLATOTERM to the VIC-20

Basic and Machine Language

Moderator: Moderators

Post Reply
tschak909
Vic 20 Drifter
Posts: 28
Joined: Wed Sep 25, 2019 8:41 am
Website: http://irata.online/
Location: Denton TX USA
Occupation: Hacker

Porting PLATOTERM to the VIC-20

Post by tschak909 »

Hello, everyone.

I'm Thom Cherryhomes, from IRATA.ONLINE.

I have been working on a massive project for the last two years: a retro-computing on-line service for every retro-computer imaginable, based on the legendary PLATO system, and to facilitate access to it, I have written a portable terminal implementation and have ported it to close to two dozen different retro-computing systems. I would like to do the same for the VIC-20, and it might just be possible, with some tricks, and I need some help from the VIC-20 demo-scene community to try and make this possible.

Main website: http://www.irata.online/
and if you'd like a historical background on the huge impact of PLATO, read here: https://en.wikipedia.org/wiki/PLATO_(computer_system)

I present here, two demos, showing both what it's like to use the system, and a demo of 13 separate systems logging onto IRATA.ONLINE and participating in a conference:

https://www.youtube.com/watch?v=rmRMXSdsF-8

https://www.youtube.com/watch?v=J9f8Vy9g7yM

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

The technical ask, and for comparison, I will give the Commodore 64:

PLATO terminals natively have a display resolution of 512x512, and can plot pixels at any point, including alphanumeric characters.

To display this on the C64's bitmap display, I do two things:

(1) scale the input of lines/dots/block fills to match 320x192 (slightly better ratio than 200, for the reason below)
(2) produce a font (for the C64, it's 5x6), so that it fits proportionally with the scaled output.

I also have routines which dynamically squeeze downloaded character set data into a user character set area, down from 8x16 to the target 5x6 font using a combination of simple scaling, or a box convolution filter (depending on the number of set to unset pixels in the glyph)

Looking at the data sheet for the VIC-I I see a max horizontal bitmap size of 192 pixels, and it is also possible to do 192 rows. and setting these values into the registers, I can see that this does indeed work. This would give just barely the minimum amount of pixels needed to synthesize a PLATO display, with a 3x6 font.

HOWEVER, as I do understand it, this falls short of the # of required double-height characters needed to display the full bitmap.

Could the VIA be used to trigger a character set change to plot the remaining bitmap data?

If someone could help me write the needed routines (if possible), I can do the needed bring-up on the VIC-20.

The current code for PLATOTERM is here:
http://github.com/tschak909/platoterm64

-Thom
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Porting PLATOTERM to the VIC-20

Post by tokra »

Since the VIC can not adresss memory outside the original 5K RAM you can just get a maximum usable resolution of 160x192 pixels which still keeps about the 4:3 ratio and works the same on PAL and NTSC. For higher resolutions you would either need to either sacrifice the lower RAM with the zeropage and stack, which makes handling those modes not so easy - or alternatively copy areas from and to the VIC-visible RAM on the fly as the raster-beam passes the screen. This would lead to a slower display in the end, but for a terminal-program this might be enough, moreso if the extra area over 160x192 is small enough.

A 192x192 image would use nearly the whole width of the NTSC-machine and may not be visible on every display-device. Also you might want to check the dimensions on-screen.
tschak909
Vic 20 Drifter
Posts: 28
Joined: Wed Sep 25, 2019 8:41 am
Website: http://irata.online/
Location: Denton TX USA
Occupation: Hacker

Re: Porting PLATOTERM to the VIC-20

Post by tschak909 »

The reason for the unusual resolution was to be able to display 64 columns by 32 lines of a 3x6 font, which is required for a PLATO terminal (they do not scroll, and the content is always assumed to be completely visible on screen at all times)

hum :(

This is unfortunately, outside of my abilities to pull off.

-Thom
tonyrocks
Vic 20 Hobbyist
Posts: 118
Joined: Mon Jan 04, 2016 10:17 pm
Website: http://www.tonyrocks.com
Location: Pittsburgh
Occupation: IBM Watson Engr

Re: Porting PLATOTERM to the VIC-20

Post by tonyrocks »

Hey Man! Good seeing you on this forum! I'm hoping some wizard appears to make a version for the VIC-20 :)
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Porting PLATOTERM to the VIC-20

Post by aeb »

Interesting project!

I would go for 192x160 display and 3x5 font on VIC 20. ALL CAPS and text-on-every-line get a little messy, but when the text is mostly a mix of uppercase and lowercase letters then it's still... somewhat readable. Fitting a few more lowercase letters like c, s, and z to a 2x4 box instead of 3x4 could help making it a even little more eye-friendly.

Here's a quick mockup and size comparison with VIC 20 standard screen. It's only 2 chars wider than standard, so it should be visible on NTSC machines too.

tinyfont.png
tinyfont.png (4.89 KiB) Viewed 5362 times
ref.png
ref.png (4.55 KiB) Viewed 5362 times
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Porting PLATOTERM to the VIC-20

Post by aeb »

Couldn't resist. Here's a quick 64x32 text routine with full 7-bit ascii.

load"miniascii.prg",8,1
sys10240 to run some test code where you can type text and move cursor (destructively). Also checks return and clear/home keys

test.png
test.png (5.25 KiB) Viewed 5326 times
Memory map:
$1000-$10ff screen matrix
$1100-$1fff bitmap

Program loads to $2000:
$2000-$21ff font
$2200-$24xx code
$2800- test program (sys10240)

Code uses zeropage $fb-$ff and $00-$02

Jump vectors:
jsr $2200 (Init: call once at startup)
jsr $2203 (Clear: clear screen)
jsr $2206 (CharOut: a = ascii 0-127, x = x-coordinate 0-63, y = y-coordinate 0-31)

miniascii-1.zip
(8.97 KiB) Downloaded 122 times
User avatar
akator
Vic 20 Afficionado
Posts: 328
Joined: Wed Apr 14, 2010 6:01 pm

Re: Porting PLATOTERM to the VIC-20

Post by akator »

^ That's impressive.
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: Porting PLATOTERM to the VIC-20

Post by Noizer »

Pretty nice text output. Could it be improved with some sort of interlacing from two charsets?
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Porting PLATOTERM to the VIC-20

Post by aeb »

Noizer wrote: Fri Nov 22, 2019 10:59 am Pretty nice text output. Could it be improved with some sort of interlacing from two charsets?
That would look nice, but unfortunately, there's not enough memory for 2 full screen bitmaps.
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Porting PLATOTERM to the VIC-20

Post by aeb »

Here's an updated version with pixel routines (and screen scrolling) included. I've moved it to RAM block 5 so that the user program can use a larger continuous block at $2000-$7fff. sys43008 to test text input

miniascii-2.zip
(10.67 KiB) Downloaded 99 times

ASCII characters 32-127 defined

Uses zero page locations $00-$01 and $fb-$fe

$1000-$10ff Text matrix
$1100-$1fff 192x160 pixel bitmap


Loads to $a000 (RAM Block 5)

Jumptable at $a000:
$a000 Init Init screen, call once at startup
$a003 Clear Clear screen
$a006 CharOut Print ASCII character a (32-127) at x, y (0-63, 0-31)
$a009 Plot Draw pixel at x, y (0-191, 0-159)
$a00c Unplot Clear pixel at x, y
$a00f FlipPixel Flip pixel at x, y
$a012 GetPixel Get pixel value from x, y to a (0-1)
$a015 Scroll Scroll screen up by 1 text line (5 pixels)

$a100-$a3ff Character set (Lower 4 bits can be later used for custom characters)

$a400-$a7ff Code
$a800-$a88d Test code (sys43008)
tschak909
Vic 20 Drifter
Posts: 28
Joined: Wed Sep 25, 2019 8:41 am
Website: http://irata.online/
Location: Denton TX USA
Occupation: Hacker

Re: Porting PLATOTERM to the VIC-20

Post by tschak909 »

HOLY SHIT! This is amazing! :)

-Thom
tschak909
Vic 20 Drifter
Posts: 28
Joined: Wed Sep 25, 2019 8:41 am
Website: http://irata.online/
Location: Denton TX USA
Occupation: Hacker

Re: Porting PLATOTERM to the VIC-20

Post by tschak909 »

Wow, sorry, I'm just..stunned!

I had racked my brain trying to figure out how to coax 192 pixels across, but then again, I'm not experienced with the VIC-I. ;)

Ok, so... from what I see here, and with memory map, this pretty much means that a PLATOTERM for the VIC-20 would have to come on cartridge. I can JUST fit PLATOTERM in about 16K (The Atari cartridge version I made fits in this space).

I'll also need to modify the user-port-2400 routines I have for the C64 to the VIC20. How does the user port map into the address space, compared to the C64?

-Thom
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Porting PLATOTERM to the VIC-20

Post by aeb »

tschak909 wrote: Sun Dec 01, 2019 4:25 pm Ok, so... from what I see here, and with memory map, this pretty much means that a PLATOTERM for the VIC-20 would have to come on cartridge. I can JUST fit PLATOTERM in about 16K (The Atari cartridge version I made fits in this space).

I'll also need to modify the user-port-2400 routines I have for the C64 to the VIC20. How does the user port map into the address space, compared to the C64?
There's plenty of free RAM, 24K at $2000-$7fff (the standard extra memory area) and 8K at $a000-$bfff (32K RAM expansion), minus 2K if we keep the text routines there. (Full RAM blocks expansion also adds 3K at $0400-$0fff, but old 16-32K RAM expansions may not have that.)

Cartridges use $a000-$bfff as ROM instead and 16K cartridges also have another 8K ROM block appearing at $6000-$7fff.

VIC 20 has two 6522 VIA chips, VIA #1 at $9110 and VIA #2 at $9120. User port is handled by VIA #1, but I've never programmed anything that uses the interface.

http://www.zimmers.net/cbmpics/cbm/vic/memorymap.txt
https://en.wikipedia.org/wiki/MOS_Technology_6522
http://archive.6502.org/datasheets/mos_ ... v_1977.pdf
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Re: Porting PLATOTERM to the VIC-20

Post by brain »

You can use an UltiMEM for extra RAM if you need it (It is a cart, but a RAM cart + ROM if desired).

Happy to load a prototype unit to you if interested.

Jim
User avatar
Ghislain
Realms of Quest
Posts: 1279
Joined: Sun Aug 08, 2004 12:54 am

Re: Porting PLATOTERM to the VIC-20

Post by Ghislain »

aeb wrote: Sun Oct 13, 2019 8:40 pm Couldn't resist. Here's a quick 64x32 text routine with full 7-bit ascii.

load"miniascii.prg",8,1
sys10240 to run some test code where you can type text and move cursor (destructively). Also checks return and clear/home keys


test.png

Memory map:
$1000-$10ff screen matrix
$1100-$1fff bitmap

Program loads to $2000:
$2000-$21ff font
$2200-$24xx code
$2800- test program (sys10240)

Code uses zeropage $fb-$ff and $00-$02

Jump vectors:
jsr $2200 (Init: call once at startup)
jsr $2203 (Clear: clear screen)
jsr $2206 (CharOut: a = ascii 0-127, x = x-coordinate 0-63, y = y-coordinate 0-31)


miniascii-1.zip
This is great. I had always wondered about how we could go beyond 40 columns for a terminal program on the VIC-20. One could even make an 80*25 character terminal with a 240*128 pixel screen using 3*5 characters like you do here. The horizontal position at $9000 would be modified when the cursor approaches the right side of the screen or by pressing a function key (like it's done in Mighty Term).

PS: I had read about PLATO over the years, and I had always wanted to try it. I have been pretty much out of the loop regarding other people's retrocomputing projects because I've been immersed in my own project for the past few years. I will definitely check out the OP's website and terminal programs for the C64 and C128. As a matter of fact, my very own Realms of Quest IV & V game engine is quite similar to the PLATO game, Oubliette (Wizardry and Bard's Tale have also been influenced by it).
"A slave is one who waits for someone to come and free him." -- Ezra Pound
Post Reply