MAXIGRAFIK: 208 x 256 true, high-resolution graphics!

Basic and Machine Language

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

MAXIGRAFIK: 208 x 256 true, high-resolution graphics!

Post by Mike »

Hi, all!

tokra and I present MAXIGRAFIK, a new BASIC extension which provides true 208x256 pixel high-resolution graphics on a PAL VIC-20 (download, at least +24K RAM required):

Image

MAXIGRAFIK adds 8 new commands and 2 functions to the BASIC interpreter:

New commands: CLEAR, SHOW, DRAW, CIRCLE, COLOR, MULTI, GSAVE, GLOAD;
New functions: POINT(), ADR().

The downloadable *.d64 (see top of post) contains the extension itself, instructions (run the file 'READ ME FIRST!' for these), lots of example programs, and a slide show (with the picture above being one of these).

The extension requires at least +24K RAM, but can make use of additional memory (3K expander or 8K in BLK5), which is then made available for bigger BASIC programs. That is controlled with the MAXICONFIG program contained on disc.

...

MAXIGRAFIK is the result of roughly two months intense collaboration, combining tokra's new developed graphic modes with MINIGRAFIK.

We both hope this new extension will be put to good use by the VIC-20 community. :)

Cheers,

Michael
Last edited by Mike on Thu Feb 20, 2014 4:21 pm, edited 2 times in total.
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

You guys are amazing. This is cutting edge stuff in the Vic community. I loaded one of the pictures (Andromeda) with GLOAD and then hit SHOW. Very cool seamless picture viewer. I am sad that it is a pal only thing, but hey you can't have it all. I'll probably never use it to program with. Keep up the great work guys. Its stuff like this that let us know: "What ever the mind can conceive, the body can achieve".
Rob
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

What can I say? You're reaching heights one couldn't imagine only months ago! Congratulations on your effort - I'll think about future implementations... :wink:
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

Great work!
Buy the new Bug-Wizard, the first 100 bugs are free!
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

GreyGhost wrote:I am sad that it is a pal only thing, but hey you can't have it all.
The method to create the new graphics mode can be transferred to NTSC without big problems. Only problem, the 6560 chip just has not a big display area enough to show 208x256 pixels! MAXIGRAFIK NTSC (or what it would be called) would need to be content with, say, 192x240 pixels.
I loaded one of the pictures (Andromeda) with GLOAD and then hit SHOW. Very cool seamless picture viewer.
You slightly seemed to miss the point here. All these pictures were actually converted with the PGM IMPORT tools, using the new commands.

This is not just a glorified picture viewer. Safe quoting the entire manual here: this extension provides access to a new graphics mode from BASIC, without the necessity for you to resort to machine language. And believe me, you wouldn't want to: the routine to calculate the correct address within the bitmap already needs some 300 bytes within the main BASIC extension itself. But you don't need to re-do this, that work has already been done. And ...
I'll probably never use it to program with.
... that sentence, while not representive in itself, is one of the kind that I'd rather choose not to comment in any way.

Please take a look at the instructions to see what you might have missed. Thanks.
User avatar
e5frog
Vic 20 Nerd
Posts: 551
Joined: Sat Feb 17, 2007 5:46 pm
Website: http://channelf.se
Location: Sweden
Occupation: Service Engineer

Post by e5frog »

It took a while before I managed to figure out how to watch the slide show...

LOAD"MAXIGRAFIK"
RUN
LOAD"SLIDE SHOW"
RUN

press space between pictures.

Avril looked fantastic!
My other interest: http://channelf.se
User avatar
tokra
Vic 20 Scientist
Posts: 1120
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Post by tokra »

Mike wrote:
GreyGhost wrote:I am sad that it is a pal only thing,
MAXIGRAFIK NTSC (or what it would be called) would need to be content with, say, 192x240 pixels.
The display-routine would have to be completely different as well. It would be a completely different program apart from the BASIC-extension.
GreyGhost wrote:I'll probably never use it to program with.
It can't possibly get any more simple than this. Just type this in or copy/paste after MAXIGRAFIK is loaded

Code: Select all

0 clear:draw1,0,0to207,255:show
1 circle1,104,128,50,100:show
Anyone who can do a "Hello World!"-program should be able to use this :) You can thank Mike for the fantastic BASIC-extension.

Any experts here interested in how the 208x256 mode itself works? Those who followed the 6-part-series "New Frontiers in VIC hires"-posts will have noticed that I barely got the 208x248 mode working and a few ideas for 208x256 fell through. Hint: The 208x256 mode uses a LOT more raster-splits...
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

My comments weren't meant to harm in any way. I understand that Maxigrafik is more that a picture viewer, that should be noted by me using the word "program" in my post. Stating that I probably would never use it just means I don't own or have the abilities to use a PAL system here in the states(that I am aware of anyways). I just don't think I would get the same enjoyment from programming something that I couldn't use on the real thing. But, Minigrafik is on my list of things to use. As I said this is cutting edge stuff. Props to you Mike and Tokra
Rob
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

I'm lucky enough to live in the PAL land, and would like to use my limited abilities with it :D .
I can see it leaves little RAM free though - I should think about a 'light' implementation of this fantastic extension.

What really puzzles me, is how could you reach such a resolution. I tried to read your post about developing this hi-res mode, but couldn't understand much :oops: .
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

This is a more lengthy post, sorry.
GreyGhost wrote:I just don't think I would get the same enjoyment from programming something that I couldn't use on the real thing.
Okay, that's something I can follow through. Sorry for that. :( I'd just like to point out, that MAXIGRAFIK had been developed mainly within VICE, and I also have yet to see it running on my own VIC-20 (tokra already confirmed me it works) - I just didn't have the time to setup my VIC in the last months. But that didn't hold me from doing this here. ;)
orion70 wrote:What really puzzles me, is how could you reach such a resolution.
As established earlier, the VIC chip can only access internal memory. Besides the character ROM, this means the bottom 1K RAM between addresses 0..1023 and the top 4K RAM between addresses 4096..8191. If we exclude the bottom 1K and do not use the CPU to assist the VIC chip in any other way than setting up the address generator in the "text" screen, and programming the VIC registers, the largest possible end result is 160x192 pixels - the resolution provided by MINIGRAFIK.

If the screen area of freely definable pixels is to be enlarged, two options are possible, both of which are used by MAXIGRAFIK: 1st, use the bottom 1K as well and 2nd, dynamically update parts of the RAM the VIC chip can access, as the raster beam scans the whole screen. The trick here is to use the address generating "text" screen to point to the same bitmap area, but at different places on screen. And update the doubly used area, while the VIC chip doesn't access it. The following example omits many details, such as the relative speed of VIC access vs. CPU access, and the "free" CPU time in the border, but should make clear how MAXIGRAFIK works:

This arrangement might be in use:

Code: Select all

 VIC displays:            CPU updates:
+-------------------+    +-------------------+
|                   |    |                   |
|  Zone A           |    |  Zone B1          |
|                   |    |                   |
+-------------------+    +-------------------+
|                   |    |                   |
|  Zone B1          |    |  idle             |
|                   |    |                   |
+-------------------+    +-------------------+
|                   |    |                   |
|  Zone C           |    |  Zone B2          |
|                   |    |                   |
+-------------------+    +-------------------+
|                   |    |                   |
|  Zone B2          |    |  idle             |
|                   |    |                   |
+-------------------+    +-------------------+
Zones A, B1, and C span the whole RAM accessible to the VIC chip. But the characters in Zone B2 point to the same part of the hires bitmap than those in Zone B1. Without further intervention by the CPU, Zone B1 and B2 would display the same content.

Now comes the trick: CPU and VIC are synchronised, so that while VIC is displaying Zone A, the CPU puts the intended data of Zone B1 into place. The CPU then idles as B1 is displayed. The VIC displays Zone C - and again the CPU puts fresh data of Zone B2 there. The result: even though B1 and B2 point to the same memory, we can display different content! In fact, we have increased the visible area by 33%.

That is really the main idea behind the increased resolution. MAXIGRAFIK takes this idea to the extreme in that the copying process is made as fast as possible, and the "idle" phases of the CPU have been minimized - which increases the display area by over 70% compared to MINIGRAFIK.
I can see it leaves little RAM free though - I should think about a 'light' implementation of this fantastic extension.
If there is RAM in BLK5, MAXIGRAFIK allows you to put the BASIC program there, i.e. 8191 BYTES FREE. This can be configured with MAXICONFIG. If your intended application needs more memory, that can be discussed here.

MAXICONFIG also allows to try out different memory configurations. But if a certain configuration is settled upon, it is possible to devise a boot-loader, which loads the display routine, the correct main program, and then autostarts the user program, as I've done with many programs that use MINIGRAFIK. Should program development of a client program advance to this stage, again, we can gladly discuss it here, too.

Greetings,

Michael

Edit: Slightly refined the example
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Thanks Mike for your explanation. I got a better general picture of the extension's intimate mechanics, and linked your post to a couple of friends who just couldn't believe it was doable :cool: .

I was wondering if MXG could be used for small office applications (graphical analysis of data, including statistics etc.). Do you remember our long-lost project? How about using MXG also for the initial screen? It shouldn't eat up much RAM...
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

Post by saehn »

Mike wrote:
GreyGhost wrote:I am sad that it is a pal only thing, but hey you can't have it all.
The method to create the new graphics mode can be transferred to NTSC without big problems. Only problem, the 6560 chip just has not a big display area enough to show 208x256 pixels! MAXIGRAFIK NTSC (or what it would be called) would need to be content with, say, 192x240 pixels.
That would still be enough to do some delicious NTSC VIC graphics! :-) Hope you are able to do MAXIGRAFIK NTSC.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

orion70 wrote:I was wondering if MXG could be used for small office applications (graphical analysis of data, including statistics etc.)
That is mainly a matter of using the available drawing commands to produce something like bar charts, line charts, scatter plots, or pie charts from the data; similar to what was already possible with MINIGRAFIK before, like this 3D bar chart shows:

http://www.sleepingelephant.com/ipw-web ... 2&start=39

... where only the "design" would need to be adjusted to make better use of the increased screen estate.

Furthermore, as there now a vertical resolution of 256 pixels is available, this allows to show the output of a 8-bit A/D converter (also with 256 possible values), without any rounding. So one could use the VIC to faithfully visualise measurements.
Do you remember our long-lost project? How about using MXG also for the initial screen?
Long, but not lost. :)

With the big resolution, there's essential no CPU time left to produce a dynamic display - so applications which require that (like, for example, MG BROWSE) are still better suited with MINIGRAFIK.

But an init screen - no problem. And when it has been displayed, one can easily remove the display routine, and reuse the memory for the own program.
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

I'm practising with MXG - BASIC graphics haven't been so fun since the Commodore 16 :P .

Image

Still tinkering with the Office project...
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Would you be so kind to post the source code for the left one? ;)
Still tinkering with the Office project...
As I wrote above, that would most probably require a "fall-back" to MINIGRAFIK, and the 40-column routines available for MG. A line-based editor for ASCII texts should be quite easy to implement in BASIC, given the components already available. If you like, we can develop this one here in Denial, in an open thread ... just post a WIP. :)
Post Reply